{% 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 %} <li> {{ title }} <ul> {% 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 %}