How to list sections?

It just confused me what .Site.Sections returned and what I falsely expected. But you already explained it in the first sentence why the type is taxonomy.


Update:

What actually confused me was that I didn’t know the return values of range. Instead of using the terrible workaround from above you can achieve the same more elegantly:

{{ range $section, $taxonomy := .Site.Sections }}
    <h4>{{ replace $section "-" " " }}</h4>
    <ul>
        {{ range $taxonomy.Pages }}
        <li><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
        {{ end }}
    </ul>
{{ end }}
1 Like