about summary refs log tree commit diff stats
path: root/templates/nav.html
blob: ac3f44e9d4e787f52cd2b9bef6ea58679311e7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{% 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 current_lang == config.default_language %}
      {% set title = item | get(key=language_key, default=item.name) %}
    {% else %}
      {% set title = item[language_key] %}
    {% endif %}
    {%- if item.url is matching("https?://") %}
      <a href="{{ item.url }}">{{ title }}</a>
    {%- else %}
      <a href="{{ get_url(path=item.url, lang=lang )}}">{{ title }}</a>
    {%- endif %}
  {%- endfor %}
{%- endif -%}