about summary refs log tree commit diff stats
path: root/templates/nav.html
blob: ba9f543f2f90634c4cae22bccbd444e287b322ab (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 %}
    {% 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 }}">{{ title }}</a>
    {%- else %}
      <a href="{{ get_url(path=item.url, lang=lang )}}">{{ title }}</a>
    {%- endif %}
  {%- endfor %}
{%- endif -%}