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/nav.html | |
parent | fe37fcf3daa0eaafc1236050ac95b5d4ba21bcd2 (diff) | |
parent | 995c4f6eff9a601c75c39d40f945c8a70d710d95 (diff) | |
download | zola-bearblog-a70fb3f413a205390b45943007400d5d9a06a72b.tar.lz zola-bearblog-a70fb3f413a205390b45943007400d5d9a06a72b.tar.zst zola-bearblog-a70fb3f413a205390b45943007400d5d9a06a72b.zip |
Merge branch 'main' into microformats2 microformats2
Diffstat (limited to 'templates/nav.html')
-rw-r--r-- | templates/nav.html | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/templates/nav.html b/templates/nav.html index e006ab1..ba9f543 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,10 +1,21 @@ -<a href="{{ config.base_url }}">Home</a> +{% set current_lang = config.default_language %} +{% if page %} + {% set current_lang = page.lang %} +{% elif section %} + {% set current_lang = section.lang %} +{% endif %} {%- if config.extra.main_menu %} {%- for item in config.extra.main_menu %} + {% if current_lang == config.default_language %} + {% set title = item.name %} + {% else %} + {% set language_key = 'name_' ~ current_lang %} + {% set title = item[language_key] %} + {% endif %} {%- if item.url is matching("https?://") %} - <a href="{{ item.url }}">{{ item.name }}</a> + <a href="{{ item.url }}">{{ title }}</a> {%- else %} - <a href="{{ get_url(path=item.url )}}">{{ item.name }}</a> + <a href="{{ get_url(path=item.url, lang=lang )}}">{{ title }}</a> {%- endif %} {%- endfor %} {%- endif -%} |