Hi,
I'm after a nested menu list of all the visible pages in the site, (always starting from the root level - homepage), the same tree structure as the pages in the admin.
The code I'm using from: , adds empty ul tags (with its class) after every <a> tag even if there's no children?
ie. <ul class="menu"></ul>
The same thing happens on the example page.
Is there something I can do to prevent the additional empty ul tags with this code and prevent the top class being added to every child ul?
Or can someone recommend some alternative code please?
Current code:
<@ snippet navigation @>
<ul class="menu">
<@ foreach in pagelist @>
<li><a href="@{ url }"<@ if @{ :current } @>class="active"<@ end @> >@{ title }</a><@ navigation @></li>
<@ end @>
</ul>
<@ end @>
<@ newPagelist {
type: 'children',
excludeHidden: true
} @>
<@ with '/' @>
<@ navigation @>
<@ end @>
Outputs:
<ul class="menu">
<li><a href="level-1.1" class="active">Level 01.1</a>
<ul class="menu">
<li><a href="level-2.1">Level 02.1</a>
<ul class="menu"></ul>
</li>
</ul>
</li>
<li><a href="level-1.2">Level 01.2</a>
<ul class="menu"></ul>
</li>
</ul>
Thanks
Andrew