I am working on a site with a dropdown top navbar and want to list all menu items in the footer, to be used sort of like a site map. All menu items are specified in the pages’ front matter.
I now I can range over a given number, say the first 5 items or so – but can I somehow range over say first, middle and last 33% of the site menu, and take into account that I want breaks before a parent each time?
<ul class="text-left main-menu" id="">
{{ $currentPage := . }}
{{ range .Site.Menus.main.ByWeight }}
{{ if .HasChildren }}
<li class=" {{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#" class="">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL | relLangURL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li>
<a href="{{ .URL | relLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>