11<!doctype html>
22< html lang ="{{ lang }} ">
3+ < head >
4+ < meta content ="IE=edge " http-equiv ="X-UA-Compatible " />
5+ < meta content ="text/html; charset=utf-8 " http-equiv ="content-type " />
6+ < meta content ="width=device-width, initial-scale=1 " name ="viewport " />
37
4- < head >
5- < meta content ="IE=edge " http-equiv ="X-UA-Compatible " />
6- < meta content ="text/html; charset=utf-8 " http-equiv ="content-type " />
7- < meta content ="width=device-width, initial-scale=1 " name ="viewport " />
8+ {% block site_meta %}
9+ < meta name ="robots " content ="index,follow ">
10+ < meta name ="googlebot " content ="index,follow ">
811
9- {% block site_meta %}
10- < meta name ="robots " content ="index,follow ">
11- < meta name =" googlebot " content =" index,follow " >
12+ < meta name =" google " content =" nositelinkssearchbox " >
13+ < meta name ="google " content ="notranslate ">
14+ {% endblock site_meta %}
1215
13- < meta name ="google " content ="nositelinkssearchbox ">
14- < meta name ="google " content ="notranslate ">
15- {% endblock site_meta %}
16+ {% block page_meta %}
17+ {% if config.description %}
18+ < meta name ="description " content ="{{ config.description | truncate(length=150) }} ">
19+ {% endif %}
20+ {% endblock page_meta %}
1621
17- {% block page_meta %}
18- {% if config.description %}
19- < meta name ="description " content ="{{ config.description | truncate(length=150) }} ">
20- {% endif %}
21- {% endblock page_meta %}
22+ {% block css %}
23+ < link href ="{{ get_url(path='style.css', trailing_slash=false) | safe }} " rel ="stylesheet " />
24+ {% endblock css %}
25+ < title > {% block title %}{{ config.title }}{% endblock title%}</ title >
26+ </ script >
27+ </ head >
28+ < body >
29+ < script >
30+ function get_theme ( ) {
31+ return localStorage . getItem ( 'prefers-color' ) || ( window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ? 'dark' : '{% if config.extra.default_theme %}{{ config.extra.default_theme }}{% else %}light{% endif %}' )
32+ }
2233
23- {% block css %}
24- < link href ="{{ get_url(path='style.css', trailing_slash=false) | safe }} " rel ="stylesheet " />
25- {% endblock css %}
26- < title > {% block title %}{{ config.title }}{% endblock title%}</ title >
27- </ script >
28- </ head >
34+ /**
35+ * This code is required here to avoid flickering the light theme when the dark theme is chosen.
36+ */
37+ function evaluate_prefers_color ( ) {
38+ const s = get_theme ( ) ;
39+ if ( s === 'dark' ) {
40+ document . body . classList . add ( 'dark' ) ;
41+ } else if ( s === 'light' ) {
42+ document . body . classList . remove ( 'dark' ) ;
43+ } else if ( window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ) {
44+ document . body . classList . add ( 'dark' ) ;
45+ }
46+ }
47+ </ script >
48+ {% block content %}
49+ < p > please fill this with a template</ p >
50+ {% endblock content %}
51+ < footer >
52+ < hr text ="© Copyright {{ now() | date(format='%Y') }} " />
53+ < div class ="footer-social-media ">
54+ < a id ="toggle-theme "> </ a >
55+ < a href ="/tags "> Tags</ a >
56+ {% if config.extra.social_media %}
57+ {% for social in config.extra.social_media %}
58+ {% if social.rel %}
59+ < a href ="{{ social.url | safe }} " rel ="{{ social.rel }} " target ="_blank "> {{ social.name }}</ a >
60+ {% else %}
61+ < a href ="{{ social.url | safe }} " target ="_blank "> {{ social.name }}</ a >
62+ {% endif %}
63+ {% endfor %}
64+ {% endif %}
65+ </ div >
66+ </ footer >
67+ </ body >
2968
30- < body >
69+ {% block js %}
3170 < script >
32- function get_theme ( ) {
33- return localStorage . getItem ( 'prefers-color' ) || ( window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ? 'dark ' : '{% if config.extra.default_theme %}{{ config.extra.default_theme }}{% else %}light{% endif %}' )
71+ function switch_language ( e ) {
72+ window . location . href = `/ ${ e . value === default_language ? '' : e . value } `
3473 }
3574
36- /**
37- * This code is required here to avoid flickering the light theme when the dark theme is chosen.
38- */
39- function evaluate_prefers_color ( ) {
40- const s = get_theme ( ) ;
41- if ( s === 'dark' ) {
42- document . body . classList . add ( 'dark' ) ;
43- } else if ( s === 'light' ) {
44- document . body . classList . remove ( 'dark' ) ;
45- } else if ( window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ) {
46- document . body . classList . add ( 'dark' ) ;
47- }
75+ function redirect ( u ) {
76+ window . location . href = u
4877 }
49- </ script >
50- {% block content %}
51- < p > please fill this with a template</ p >
52- {% endblock content %}
53- < footer >
54- < hr text ="© Copyright {{ now() | date(format='%Y') }} " />
55- < div class ="footer-social-media ">
56- < a id ="toggle-theme "> </ a >
57- < a href ="/tags "> Tags</ a >
58- {% if config.extra.social_media %}
59- {% for social in config.extra.social_media %}
60- {% if social.rel %}
61- < a href ="{{ social.url | safe }} " rel ="{{ social.rel }} " target ="_blank "> {{ social.name }}</ a >
62- {% else %}
63- < a href ="{{ social.url | safe }} " target ="_blank "> {{ social.name }}</ a >
64- {% endif %}
65- {% endfor %}
66- {% endif %}
67- </ div >
68- </ footer >
69- </ body >
70-
71- {% block js %}
72- < script >
73- function switch_language ( e ) {
74- window . location . href = `/${ e . value === default_language ? '' : e . value } `
75- }
76-
77- function redirect ( u ) {
78- window . location . href = u
79- }
8078
81- function toggle_prefers_color ( ) {
82- localStorage . setItem ( 'prefers-color' , get_theme ( ) === 'dark' ? 'light' : 'dark' ) ;
83- evaluate_prefers_color ( ) ;
84- }
85-
86- function init_toggle_theme ( ) {
87- const el = document . getElementById ( 'toggle-theme' )
88- const renderState = ( ) => {
89- // Icons from https://fonts.google.com/icons
90- el . innerHTML = get_theme ( ) === 'dark'
91- ? `<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M479.765 716Q538 716 579 675.235q41-40.764 41-99Q620 518 579.235 477q-40.764-41-99-41Q422 436 381 476.765q-41 40.764-41 99Q340 634 380.765 675q40.764 41 99 41Zm.235 60q-83 0-141.5-58.5T280 576q0-83 58.5-141.5T480 376q83 0 141.5 58.5T680 576q0 83-58.5 141.5T480 776ZM70 606q-12.75 0-21.375-8.675Q40 588.649 40 575.825 40 563 48.625 554.5T70 546h100q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T170 606H70Zm720 0q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T790 546h100q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T890 606H790ZM479.825 296Q467 296 458.5 287.375T450 266V166q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825 0 21.325 8.625T510 166v100q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625Zm0 720q-12.825 0-21.325-8.62-8.5-8.63-8.5-21.38V886q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825 0 21.325 8.625T510 886v100q0 12.75-8.675 21.38-8.676 8.62-21.5 8.62ZM240 378l-57-56q-9-9-8.629-21.603.37-12.604 8.526-21.5 8.896-8.897 21.5-8.897Q217 270 226 279l56 57q8 9 8 21t-8 20.5q-8 8.5-20.5 8.5t-21.5-8Zm494 495-56-57q-8-9-8-21.375T678.5 774q8.5-9 20.5-9t21 9l57 56q9 9 8.629 21.603-.37 12.604-8.526 21.5-8.896 8.897-21.5 8.897Q743 882 734 873Zm-56-495q-9-9-9-21t9-21l56-57q9-9 21.603-8.629 12.604.37 21.5 8.526 8.897 8.896 8.897 21.5Q786 313 777 322l-57 56q-8 8-20.364 8-12.363 0-21.636-8ZM182.897 873.103q-8.897-8.896-8.897-21.5Q174 839 183 830l57-56q8.8-9 20.9-9 12.1 0 20.709 9Q291 783 291 795t-9 21l-56 57q-9 9-21.603 8.629-12.604-.37-21.5-8.526ZM480 576Z"/></svg>`
92- : `<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M480 936q-150 0-255-105T120 576q0-150 105-255t255-105q8 0 17 .5t23 1.5q-36 32-56 79t-20 99q0 90 63 153t153 63q52 0 99-18.5t79-51.5q1 12 1.5 19.5t.5 14.5q0 150-105 255T480 936Zm0-60q109 0 190-67.5T771 650q-25 11-53.667 16.5Q688.667 672 660 672q-114.689 0-195.345-80.655Q384 510.689 384 396q0-24 5-51.5t18-62.5q-98 27-162.5 109.5T180 576q0 125 87.5 212.5T480 876Zm-4-297Z"/></svg>`
93- evaluate_prefers_color ( )
94- }
95- el . onclick = ( ) => {
79+ function toggle_prefers_color ( ) {
9680 localStorage . setItem ( 'prefers-color' , get_theme ( ) === 'dark' ? 'light' : 'dark' ) ;
97- renderState ( )
81+ evaluate_prefers_color ( ) ;
9882 }
99- renderState ( )
100- }
10183
102- init_toggle_theme ( )
103- </ script >
104- {% endblock js %}
84+ function init_toggle_theme ( ) {
85+ const el = document . getElementById ( 'toggle-theme' )
86+ const renderState = ( ) => {
87+ // Icons from https://fonts.google.com/icons
88+ el . innerHTML = get_theme ( ) === 'dark'
89+ ? `<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M479.765 716Q538 716 579 675.235q41-40.764 41-99Q620 518 579.235 477q-40.764-41-99-41Q422 436 381 476.765q-41 40.764-41 99Q340 634 380.765 675q40.764 41 99 41Zm.235 60q-83 0-141.5-58.5T280 576q0-83 58.5-141.5T480 376q83 0 141.5 58.5T680 576q0 83-58.5 141.5T480 776ZM70 606q-12.75 0-21.375-8.675Q40 588.649 40 575.825 40 563 48.625 554.5T70 546h100q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T170 606H70Zm720 0q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T790 546h100q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T890 606H790ZM479.825 296Q467 296 458.5 287.375T450 266V166q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825 0 21.325 8.625T510 166v100q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625Zm0 720q-12.825 0-21.325-8.62-8.5-8.63-8.5-21.38V886q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825 0 21.325 8.625T510 886v100q0 12.75-8.675 21.38-8.676 8.62-21.5 8.62ZM240 378l-57-56q-9-9-8.629-21.603.37-12.604 8.526-21.5 8.896-8.897 21.5-8.897Q217 270 226 279l56 57q8 9 8 21t-8 20.5q-8 8.5-20.5 8.5t-21.5-8Zm494 495-56-57q-8-9-8-21.375T678.5 774q8.5-9 20.5-9t21 9l57 56q9 9 8.629 21.603-.37 12.604-8.526 21.5-8.896 8.897-21.5 8.897Q743 882 734 873Zm-56-495q-9-9-9-21t9-21l56-57q9-9 21.603-8.629 12.604.37 21.5 8.526 8.897 8.896 8.897 21.5Q786 313 777 322l-57 56q-8 8-20.364 8-12.363 0-21.636-8ZM182.897 873.103q-8.897-8.896-8.897-21.5Q174 839 183 830l57-56q8.8-9 20.9-9 12.1 0 20.709 9Q291 783 291 795t-9 21l-56 57q-9 9-21.603 8.629-12.604-.37-21.5-8.526ZM480 576Z"/></svg>`
90+ : `<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M480 936q-150 0-255-105T120 576q0-150 105-255t255-105q8 0 17 .5t23 1.5q-36 32-56 79t-20 99q0 90 63 153t153 63q52 0 99-18.5t79-51.5q1 12 1.5 19.5t.5 14.5q0 150-105 255T480 936Zm0-60q109 0 190-67.5T771 650q-25 11-53.667 16.5Q688.667 672 660 672q-114.689 0-195.345-80.655Q384 510.689 384 396q0-24 5-51.5t18-62.5q-98 27-162.5 109.5T180 576q0 125 87.5 212.5T480 876Zm-4-297Z"/></svg>`
91+ evaluate_prefers_color ( )
92+ }
93+ el . onclick = ( ) => {
94+ localStorage . setItem ( 'prefers-color' , get_theme ( ) === 'dark' ? 'light' : 'dark' ) ;
95+ renderState ( )
96+ }
97+ renderState ( )
98+ }
10599
100+ init_toggle_theme ( )
101+ </ script >
102+ {% endblock js %}
106103</ html >
0 commit comments