aboutsummaryrefslogtreecommitdiff
path: root/templates/base.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/base.html')
-rw-r--r--templates/base.html60
1 files changed, 27 insertions, 33 deletions
diff --git a/templates/base.html b/templates/base.html
index d16854c..97d2f4d 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,29 +1,22 @@
-{%- import 'macros/seo.html' as macros_seo %}
-{%- import "macros/macros.html" as macros %}
-{# Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. #}
+{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. -#}
{%- set i18n = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%}
-{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif %}
-
+{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif -%}
{%- set uglyurls = config.extra.uglyurls | default(value=false) -%}
-{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %}
+{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%}
<!DOCTYPE html>
<html lang="{%- if lang != config.default_language %}{{ lang }}{% else %}{{ config.extra.language_code | default(value=lang) }}{% endif %}">
<head>
- {%- include "partials/head.html" %}
-
- {#- SEO: title, description, etc #}
- {%- block seo %}
- {%- if config.extra.title_separator %}
+ {%- include "partials/head.html" -%}
+ {#- SEO: title, description, etc -#}
+ {%- block seo -%}
+ {%- if config.extra.title_separator -%}
{%- set title_separator = " " ~ config.extra.title_separator ~ " " -%}
- {%- else %}
+ {%- else -%}
{%- set title_separator = " | " -%}
- {%- endif %}
- {%- endblock seo %}
-
- {%- block comments_init %}
- {%- endblock comments_init %}
-
- {%- include "partials/head_js.html" %}
+ {%- endif -%}
+ {%- endblock seo -%}
+ {%- block comments_init -%}{%- endblock comments_init -%}
+ {%- include "partials/head_js.html" -%}
</head>
<body>
{%- block header %}
@@ -33,10 +26,10 @@
{%- if config.extra.logo -%}
<big><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}" title="{{config.title}}">
- {%- 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 }}"{%- else %} alt=""{%- 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 %} />
+ {%- 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 }}"{%- else %} alt=""{%- 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 -%}
+ {%- if config.extra.logo?.text -%}{{ config.extra.logo?.text | safe }}{%- endif -%}
</a></big>
{%- elif config.extra.textlogo -%}
@@ -55,8 +48,8 @@
{%- set js_switcher=config.extra.js_switcher | default(value=true) %}
{%- if config.extra.menu %}
{%- for i in config.extra.menu -%}
- <li><a{%- if i.size %} class="{{ i.size }}"{% endif %} href="{%- if i.url is matching("^http[s]?://") %}{{ i.url }}{%- else -%}{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>
- {%- if lang != config.default_language %} {{ macros::translate(key=i.name|safe, default=i.name|safe, i18n=i18n) }} {% else %} {{ i.name | safe }} {% endif -%}
+ <li><a{%- if i.size %} class="{{ i.size }}"{% endif %} href="{%- if i.url is matching(pat="^http[s]?://") %}{{ i.url }}{%- else -%}{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>
+ {%- if lang != config.default_language %} {{<translate key={i.name | safe} default={i.name | safe} i18n={i18n} />}} {% else %} {{ i.name | safe }} {% endif -%}
</a></li>
{%- endfor -%}
{%- endif -%}
@@ -65,17 +58,17 @@
<li><div class="dropdown"><i class="svgs world" type="reset"></i>
{%- if current_url %}
<div class="dropdown-content">
- <span>{{ macros::translate(key="language_name", default="lang_name", i18n=i18n) }}</span>
+ <span>{{<translate key="language_name" default="lang_name" i18n={i18n} />}}</span>
{%- for lcode,language in config.languages -%}
{%- set i18n_menu = load_data(path="i18n/" ~ lcode ~ '.toml', required=false) -%}
{%- if not i18n_menu -%}{%- set i18n_menu = load_data(path="themes/abridge/i18n/" ~ lcode ~ ".toml", required=false) -%}{%- endif %}
{%- if lang != lcode -%}
{%- if lcode == config.default_language -%}
- <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a>
+ <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a>
{%- elif lang == config.default_language -%}
- <a href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a>
+ <a href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a>
{%- else -%}
- <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/' ~ lcode ~ '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a>
+ <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/' ~ lcode ~ '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a>
{%- endif -%}
{%- endif -%}
{%- endfor -%}
@@ -98,7 +91,7 @@
<div>
<form autocomplete=off class="js" name="goSearch" id="searchbox">
<div class="searchd">
- <input id="searchinput" type="text" placeholder="{{ macros::translate(key="Search", default="Search", i18n=i18n) }}" title="Search" />
+ <input id="searchinput" type="text" placeholder="{{<translate key="Search" default="Search" i18n={i18n} />}}" title="Search" />
<button type="submit" title="Search" class="{%- if icon_search -%}{{ icon_search }}{%- else -%}si{%- endif -%}">{%- if not icon_search -%}&#8981;{%- endif -%}</button>
</div>
<div class="results"><div id="suggestions"></div></div>
@@ -136,14 +129,14 @@
{%- if config.extra.menu_footer %}
<nav class="vpad">
{%- for i in config.extra.menu_footer -%}
- {%- if i.url is matching("^http[s]?://") %}
+ {%- if i.url is matching(pat="^http[s]?://") %}
{%- set furl=i.url %}
{%- elif 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 class="rpad{%- if i.size %} {{ i.size }}{% endif %}" href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{ macros::translate(key=i.name|safe, default=i.name|safe, i18n=i18n) }} {% else %} {{ i.name | safe }} {% endif %}</a>
+ <a class="rpad{%- if i.size %} {{ i.size }}{% endif %}" href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{<translate key={i.name | safe} default={i.name | safe} i18n={i18n} />}} {% else %} {{ i.name | safe }} {% endif %}</a>
{%- endfor %}
</nav>
{%- endif %}
@@ -155,7 +148,8 @@
{%- if config.extra.copyright_override -%}
{%- if lang != config.default_language %}
- {%- set copyright_string = macros::translate(key='copyright_override', default='© $CURRENT_YEAR $SITE_TITLE', i18n=i18n) | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %}
+ {%- set copyright_string %}{{<translate key="copyright_override" default="© $CURRENT_YEAR $SITE_TITLE" i18n={i18n} />}}{% endset -%}
+ {%- set copyright_string = copyright_string | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %}
{% else %}
{%- set copyright_string = config.extra.copyright_override | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %}
{% endif -%}
@@ -170,7 +164,7 @@
{%- 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 %}>{{ macros::translate(key="Powered_by", default="Powered by", i18n=i18n) }} <a href="https://www.getzola.org/" target="_blank">Zola</a> {{ macros::translate(key="and", default="and", i18n=i18n) }} <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p>
+ <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>{{<translate key="Powered_by" default="Powered by" i18n={i18n} />}} <a href="https://www.getzola.org/" target="_blank">Zola</a> {{<translate key="and" default="and" i18n={i18n} />}} <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p>
{%- endif %}
{%- endif %}
</div>