Can I split a .Site.Menu range over multiple columns?

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>

My suggestion is to break this into two parts:

  1. Ranging over the menu
  2. Setting up your CSS

We can help you with the menu, for the CSS please check Recommended Reading Reference. Please follow the advice at Requesting Help and share your code so we can see what you’ve done. :slight_smile:

1 Like

Thank you, I will rephrase.

1 Like