Make previous commit actually work

This is a huge mess, Zola is really not i18n-friendly
This commit is contained in:
daudix
2024-06-16 04:57:51 +03:00
parent a4a68c8b61
commit 7bb9b19e77
12 changed files with 68 additions and 49 deletions

View File

@ -1,12 +0,0 @@
{% if config.extra.language_switcher %}
<div class="lang" aria-label="{{ trans(key="language", lang=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 %}
<span class="active">{{ tr.name }}</span>
{% else %}
<a href="{{ get_url(path=language_agnostic_path, lang=tr.code) ~ "/" }}" hreflang="{{ tr.code }}" lang="{{ tr.code }}">{{ tr.name }}</a>
{% endif %}
{% endfor %}
</div>
{% endif %}