winkekatze.tv/templates/blocks/navigation.html

60 lines
2 KiB
HTML
Raw Permalink Normal View History

2022-01-21 03:59:34 +01:00
{% block navigation %}
<nav>
<ul>
{% for title, mapping in bag("navigation").items() %}
{% if mapping.visible|default(true) %}
{% if not mapping.list_childs %}
<li>
<a
2022-10-28 21:57:57 +02:00
{% if this._path == mapping.href %} class="active" {% endif %}
{% if mapping.external | default(false) %}
href="{{ mapping.href }}" target="_blank" rel="noopener noreferrer"
{% else %}
href="{{ mapping.href | url }}"
{% endif %}>
2022-01-21 03:59:34 +01:00
{{- title -}}
</a>
{% else %}
<li class="dropdown">
<button type="button" class="title_dropdown" aria-expanded="false" aria-controls="sweets-dropdown">
{{ title }}
</button>
<ul class="dropdown__menu">
{% set sub_menu = mapping['items'].items() %}
{% for sub_title, href in sub_menu %}
{% if sub_title != "list_namespace" %}
<li>
<a
{% if this._path == href %}
{{- ' class="active"' }}
{% endif %} {{- ' ' -}}
href="{{ href }}">
{{- sub_title -}}
</a>
</li>
{% else %}
{% set children = site.get(href).children %}
{% for child in children %}
{% if loop.index <= 3 %}
<li>
<a
{% if this._path + '/' == child.url_path %}
{{- ' class="active"' -}}
{% endif %} {{- ' ' -}}
href="{{ child.url_path }}">
{{- child.title -}}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</nav>
{% endblock %}