chaoswest.tv/templates/blocks/navigation.html

55 lines
1.7 KiB
HTML
Raw Normal View History

2022-01-20 23:51:09 +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
{% if this._path == mapping.href %} class="active"
{% endif %} {{- ' ' -}}
href="{{ mapping.href|url }}">
{{- title -}}
</a>
{% else %}
2022-05-01 14:51:42 +02:00
<li>
2022-01-20 23:51:09 +01:00
{{ title }}
2022-05-01 14:51:42 +02:00
<ul>
2022-01-20 23:51:09 +01:00
{% 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 %}