diff options
Diffstat (limited to 'templates/base.html')
| -rw-r--r-- | templates/base.html | 86 |
1 files changed, 59 insertions, 27 deletions
diff --git a/templates/base.html b/templates/base.html index 736912f..228b396 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,13 +3,13 @@ {%- import "macros/page.html" as page_macros %} {%- import "macros/macros.html" as macros %} <!DOCTYPE html> -<html lang="{{ config.extra.language_code | default(value='en-US') }}"> +<html lang="{%- if lang != config.default_language %}{{ lang }}{% else %}{{ config.extra.language_code | default(value=lang) }}{% endif %}"> <head> {{- macros_head::theme(config=config) }} {{- macros_head::stylesheets(config=config) }} <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> {{- macros_head::stylesheets_preload(config=config) }} {{- macros_head::js(config=config) }} <meta name="base" content="{{ config.base_url | safe }}" /> @@ -28,11 +28,7 @@ {{- macros_head::security(config=config) }} {{- macros_head::favicons(config=config) }} <noscript><link rel="stylesheet" href="{{ get_url(path='nojs.css', trailing_slash=false) | safe }}" /></noscript> - {%- block comments_init %} - {%- if config.extra.comments.hyvor %} - <script async src="https://talk.hyvor.com/embed/embed.js" type="module"></script> - {%- endif %} {%- endblock comments_init %} </head> <body> @@ -41,36 +37,62 @@ <nav> <div> {%- if config.extra.logo -%} - <h1><a href="{{ config.base_url | safe }}/{%- if config.extra.uglyurls %}index.html{%- endif %}"> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls %}/index.html{%- endif %}"> {%- if config.extra.logo.file -%} <img src="{{ config.base_url | safe }}/{{ config.extra.logo.file | safe }}"{%- if config.extra.logo.alt %} alt="{{ config.extra.logo.alt | safe }}"{%- endif %}{%- if config.extra.logo.width %} width="{{ config.extra.logo.width | safe }}"{%- endif %}{%- if config.extra.logo.height %} height="{{ config.extra.logo.height | safe }}"{%- endif %} /> {%- endif -%} {%- if config.extra.logo.text -%}{{ config.extra.logo.text | safe }}{%- endif -%} </a></h1> {%- elif config.extra.textlogo -%} - <h1><a href="{{ config.base_url | safe }}/{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ config.extra.textlogo | safe }}</a></h1> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls -%} + {%- if lang == config.default_language -%}/{%- endif -%} + index.html{%- endif -%}">{{ config.extra.textlogo | safe }}</a></h1> {%- elif config.title -%} - <h1><a href="{{ config.base_url | safe }}/{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ config.title | safe }}</a></h1> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls %}/index.html{%- endif %}">{{ config.title | safe }}</a></h1> {%- endif -%} </div> <div> - <ul> - {%- for i in config.extra.menu -%} - <li> <h2><a href="{{ get_url(path=i.url, trailing_slash=i.slash) }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{{ i.name | safe }}</a></h2> </li> - {%- endfor -%} - {%- if config.extra.js_theme -%} - <li class="js">{%- if config.extra.icon_adjust -%}<i type="reset" id="mode" class="{{ config.extra.icon_adjust }}"></i>{%- else -%}<i type="reset" id="mode" class="mode">☀</i>{%- endif -%}</li> + {% set js_switcher=config.extra.js_switcher | default(value=true) %} + {%- if config.extra.menu or js_switcher %} + {%- if config.extra.menu %} + {%- for i in config.extra.menu -%} + <a href="{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> + {%- if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif -%} + </a> + {%- endfor -%} + {%- endif -%} + {%- if js_switcher -%} + {%- set icon_adjust=config.extra.icon_adjust | default(value="svgs adjust") -%} + {%- if icon_adjust -%}<i type="reset" id="mode" class="js {{ icon_adjust }}"></i>{%- else -%}<i type="reset" id="mode" class="js mode">☀</i>{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- if config.languages | length > 0 %} + <div class="dropdown" type="Button"> {%- if lang != config.default_language %}{{ trans(key="flag" | safe, lang=lang) }}{% else %}{{ config.extra.flag.en }}{% endif %} + {%- if current_url %} + <div class="dropdown-content"> + {%- for lcode,flag in config.extra.flag -%} + {%- if lang != lcode -%} + {%- if lcode == config.default_language -%} + <a type="Button" href="{{ current_url | replace(from=current_path | truncate(length=4, end=""), to="/") | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> + {%- else -%} + <a type="Button" href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> {%- endif -%} - </ul> + {%- endif -%} + {%- endfor -%} + </div> + {%- endif %} + </div> + {%- endif %} </div> {%- if config.build_search_index %} + {%- set icon_search=config.extra.icon_search | default(value="svgs search") %} <div> <form autocomplete=off class="js" name="goSearch" id="searchbox"> <div class="searchd"> - <input id="searchinput" type="text" placeholder="Search" title="Search"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork" {% endif %}{% endif %} /> - <button type="submit" title="Search">{%- if config.extra.icon_search -%}<i class="{{ config.extra.icon_search }}"></i>{%- else -%}<span class="si">⌕</span>{%- endif -%}</button> + <input id="searchinput" type="text" placeholder="{%- if lang != config.default_language %}{{ trans(key="Search" | safe, lang=lang) }}{% else %}Search{% endif %}" title="Search"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork" {% endif %}{% endif %} /> + <button type="submit" title="Search" class="{%- if icon_search -%}{{ icon_search }}{%- else -%}si{%- endif -%}">{%- if not icon_search -%}⌕{%- endif -%}</button> </div> - <div><div id="suggestions"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork-output" {% endif %}{% endif %}></div></div> + <div class="results"><div id="suggestions"{% if config.extra.search_library %}{% if config.extra.search_library == "stork" %} data-stork="stork-output" {% endif %}{% endif %}></div></div> </form> </div> {%- endif %} @@ -95,26 +117,36 @@ <hr /> {%- endif %} <div class="c"> - {{- social_macros::social_links(social_config=config.extra.social, config=config) }} + {{- social_macros::social_links(config=config) }} {#- Copyright START #} + {%- set copyright_start_string=config.extra.copyright_start_string | default(value="©") %} + {%- if copyright_start_string %}{%- set copyright_start_string=copyright_start_string ~ " " %}{%- endif %} {%- set copyright_start_year=config.extra.copyright_start_year | default(value="") %} {%- if copyright_start_year %}{%- set copyright_start_year=copyright_start_year ~ "-" %}{%- endif %} {%- set copyright_end_year=config.extra.copyright_end_year | default(value=now() | date(format="%Y")) %} - <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>Copyright © {{ copyright_start_year ~ copyright_end_year }} {{ config.title }}</p> + {%- if config.extra.copyright_entity %}{%- set copyright_entity= " " ~ config.extra.copyright_entity %}{%- else %}{%- set copyright_entity= " " ~ config.title %}{%- endif %} + {%- set copyright_end_string=config.extra.copyright_end_string | default(value="") %} + {%- if copyright_end_string %}{%- set copyright_end_string= " " ~ copyright_end_string %}{%- endif %} + <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}> {{ copyright_start_string ~ copyright_start_year ~ copyright_end_year ~ copyright_entity ~ copyright_end_string }}</p> {#- Copyright END #} + {%- if config.extra.menu_footer %} <nav> - <ul> - {%- for i in config.extra.menu_footer -%} - <li{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}> <a href="{{ get_url(path=i.url, trailing_slash=i.slash) }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> {{ i.name | safe }} </a> </li> - {%- endfor -%} - </ul> + {%- for i in config.extra.menu_footer -%} + {%- if i.url != "sitemap.xml" %} + {%- set furl=get_url(path=i.url, lang=lang, trailing_slash=i.slash) %} + {%- else %} + {%- set furl=get_url(path=i.url, trailing_slash=i.slash) %} + {%- endif %} + <a{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %} href="{{ furl | safe }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif %}</a> + {%- endfor %} </nav> + {%- endif %} {%- if config.extra.footer_credit | default(value=true) %} {%- if config.extra.footer_credit_override %} {{ config.extra.footer_credit_override | safe }} {%- else %} - <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>Powered by <a href="https://www.getzola.org/" target="_blank">Zola</a> and <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p> + <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>{% if lang != config.default_language -%} {{ trans(key="Powered_by" | safe, lang=lang) }} {% else -%} Powered by {% endif %}<a href="https://www.getzola.org/" target="_blank">Zola</a> {%- if lang != config.default_language %} {{ trans(key="and" | safe, lang=lang) }} {% else %} and {% endif -%} <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p> {%- endif %} {%- endif %} </div> |
