chaoswest.tv/templates/blocks/navigation.html

60 lines
1.8 KiB
HTML
Raw Permalink 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"
2024-01-21 23:22:19 +01:00
{% endif %}
2022-01-20 23:51:09 +01:00
href="{{ mapping.href|url }}">
2024-01-21 23:22:19 +01:00
{{ title }}
2022-01-20 23:51:09 +01:00
</a>
{% else %}
2022-05-01 14:51:42 +02:00
<li>
2024-01-21 23:22:19 +01:00
<a
{% if this._path == mapping.href %} class="active"
{% endif %}
href="{{ mapping.href|url }}">
{{ title }}
</a>
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 %}
2024-01-21 23:22:19 +01:00
class="active"
{% endif %}
2022-01-20 23:51:09 +01:00
href="{{ href }}">
2024-01-21 23:22:19 +01:00
{{ sub_title }}
2022-01-20 23:51:09 +01:00
</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 %}
2024-01-21 23:22:19 +01:00
' class="active"
{% endif %}
2022-01-20 23:51:09 +01:00
href="{{ child.url_path }}">
2024-01-21 23:22:19 +01:00
{{ child.title }}
2022-01-20 23:51:09 +01:00
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</nav>
{% endblock %}