diff options
author | Alan Pearce | 2024-05-28 23:23:33 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-28 23:23:33 +0200 |
commit | a70fb3f413a205390b45943007400d5d9a06a72b (patch) | |
tree | 2ca6b45c37ddd89054e46d523d5cd6e3c3c3c133 /templates/language_switcher.html | |
parent | fe37fcf3daa0eaafc1236050ac95b5d4ba21bcd2 (diff) | |
parent | 995c4f6eff9a601c75c39d40f945c8a70d710d95 (diff) | |
download | zola-bearblog-microformats2.tar.lz zola-bearblog-microformats2.tar.zst zola-bearblog-microformats2.zip |
Merge branch 'main' into microformats2 microformats2
Diffstat (limited to 'templates/language_switcher.html')
-rw-r--r-- | templates/language_switcher.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/templates/language_switcher.html b/templates/language_switcher.html new file mode 100644 index 0000000..512b409 --- /dev/null +++ b/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 %} + <active>{{ tr.name }}</active> + {%- else %} + <a href="{{ get_url(path=language_agnostic_path, lang=tr.code) ~ "/" }}" hreflang="{{ tr.code }}">{{ tr.name }}</a> + {%- endif %} + {%- endfor %} + </nav> +{% endif %} |