Page navigation
Outputting a site navigation using the configuration set within the Site Builder
Multi-level navigation
<ul class="nav navbar-nav navbar-right">
{% for item in linklists.mainmenu recursive -%}
<li class="{%- if item.children %}dropdown{% endif %}{% if page.path == item.link %} active{% endif %}{% for sub_item in item.children %}{% if page.path == sub_item.link %} active{% endif %}{% endfor %}">
{%- if item.children %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ item.name|safe }} <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for sub_item in item.children %}
<li><a href="{{ sub_item.link }}">{{ sub_item.name|safe }}</a></li>
{% endfor %}
</ul>
{% else %}
<a href="{{ item.link }}">{{ item.name|safe }}</a>
{% endif %}
{%- endfor -%}
</ul>Last updated
Was this helpful?