all repos — zola-bearblog @ 1c52ee3cc089e6b7ef8f38d1e6530b219239bd2e

Port of bear blog theme to zola

Translation link now pointing to the translation of the current page

g4m4
commit

1c52ee3cc089e6b7ef8f38d1e6530b219239bd2e

parent

cfe243132912e9a21e7de990836380f4356ba92d

1 file changed, 6 insertions(+), 1 deletion(-)

jump to
M templates/language_switcher.htmltemplates/language_switcher.html
@@ -1,10 +1,15 @@
{% if config.extra.language_switcher %} <nav> + {%- if current_path %} + {%- set language_agnostic_path=current_path | replace(from='/' ~ lang ~ '/', to = '/') | trim_start_matches(pat = '/') -%} + {%- endif %} {%- for tr in config.extra.translations %} {%- if tr.code == lang %} <strong>{{ tr.name }}</strong> {%- else %} - <a href="{{ get_url(path="/", lang=tr.code) }}">{{ tr.name }}</a> + {%- if language_agnostic_path %} + <a href="{{ get_url(path=language_agnostic_path, lang=tr.code) }}">{{ tr.name }}</a> + {%- endif %} {%- endif %} {%- endfor %} </nav>