about summary refs log tree commit diff stats
path: root/templates/nav.html
diff options
context:
space:
mode:
authorAlan Pearce2024-02-18 13:58:34 +0100
committerAlan Pearce2024-02-18 20:40:21 +0100
commita6000685cfcbb4253f634b44637b599cec96d5bc (patch)
tree14bbf91452f561d8a5b084985a409efa4e5238b0 /templates/nav.html
parent5a936b5c413b541c5523da6b4ebdc46f996f7360 (diff)
downloadzola-bearblog-a6000685cfcbb4253f634b44637b599cec96d5bc.tar.lz
zola-bearblog-a6000685cfcbb4253f634b44637b599cec96d5bc.tar.zst
zola-bearblog-a6000685cfcbb4253f634b44637b599cec96d5bc.zip
Create basic German version of website
Diffstat (limited to 'templates/nav.html')
-rw-r--r--templates/nav.html11
1 files changed, 9 insertions, 2 deletions
diff --git a/templates/nav.html b/templates/nav.html
index a71652e..cd2d391 100644
--- a/templates/nav.html
+++ b/templates/nav.html
@@ -1,9 +1,16 @@
+{% 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 %}
+    {% set language_key = 'name_' ~ current_lang %}
     {%- if item.url is matching("https?://") %}
-      <a href="{{ item.url }}">{{ item.name }}</a>
+      <a href="{{ item.url }}">{{ item[language_key] }}</a>
     {%- else %}
-      <a href="{{ get_url(path=item.url, lang=lang )}}">{{ item.name }}</a>
+      <a href="{{ get_url(path=item.url, lang=lang )}}">{{ item[language_key] }}</a>
     {%- endif %}
   {%- endfor %}
 {%- endif -%}