all repos — zola-bearblog @ 333e97f135264c3c220063b2b64bf4dc0b508f34

Port of bear blog theme to zola

Merge pull request 'Basic multilingual site' (#10) from multilingual into main Reviewed-on: https://codeberg.org/alanpearce/zola-bearblog/pulls/10

Alan Pearce
commit

333e97f135264c3c220063b2b64bf4dc0b508f34

parent

5a936b5c413b541c5523da6b4ebdc46f996f7360

1 file changed, 12 insertions(+), 0 deletions(-)

changed files
A templates/language_switcher.html
@@ -0,0 +1,12 @@
+{% if config.extra.language_switcher %} + <nav class="lang"> + {%- set language_agnostic_path = current_path | default(value="/") | replace(from='/' ~ lang ~ '/', to = '/') | trim_start_matches(pat = '/') -%} + {%- for tr in config.extra.translations %} + {%- if tr.code == lang %} + <strong>{{ tr.name }}</strong> + {%- else %} + <a href="{{ get_url(path=language_agnostic_path, lang=tr.code) ~ "/" }}" hreflang="{{ tr.code }}">{{ tr.name }}</a> + {%- endif %} + {%- endfor %} + </nav> +{% endif %}