Hi,
I’m looking for a way to display only a specific party of my navigation in the sidebar. I’m using the Antimatter theme. What I accomplished is, I copied the relevant parts from navigation.html.twig to the sidebar.html.twig
{% macro loop(page) %}
{% for p in page.children.visible %}
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
{% if p.children.visible.count > 0 %}
<li class="has-children {{ current_page }}">
<a href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
<span></span>
</a>
<ul>
{{ _self.loop(p) }}
</ul>
</li>
{% else %}
<li class="{{ current_page }}">
<a href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
<ul class="navigation">
{{ _self.loop(pages) }}
{% for mitem in site.menu %}
<li>
<a href="{{ mitem.url }}">
{% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
{{ mitem.text }}
</a>
</li>
{% endfor %}
</ul>
I have a navigation with at least 3 levels
ROOT
|-A LEVEL 1
| '-A LEVEL 2
| '-A LEVEL 3
|-B LEVEL 1
| '-B LEVEL 2
| '-B LEVEL 3
'-C LEVEL 1
Whenever I am located in a subbranch of LEVEL 1, I only want to display the complete structure of its subbranch. For example, if I am in A Level 2, I want to display the whole A tree. If I am in B Level 3 I want the complete B tree.
May somebody help?