List of posts sectioned by category or taxonomy

I’ve been looking through the documentation in order to find the best way to do this. I’m looking to have sections like this: for my content pages. I want to create a page like that page. Is that possible?


Sure, I think you should be able to accomplish this using Hugo’s built-in .GroupBy method in your templating logic. You can then group by sections, date, etc. I believe you can also group according to your own custom variables as well. So, for example, you could set something like the following in the yaml of your individual files:

supportGroup: "Getting Started"
# Or "Temperature Sensors" or "Scheduling for Employees" or "Scheduling for Managers" (using your example site from

That was a great tipoff! I couldn’t get it to work though…Instead of grouping by, I decided to go this route.

<section id="menu">
        {{ range $key, $taxonomy := .Site.Taxonomies.categories }}
        <li> {{ $key }} </li>
            {{ range $taxonomy.Pages }}
            <li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
            {{ end }}
        {{ end }}

My question now, is whether or not there would be any way to sort the taxonomy keys? By either the groupby or this strategy?

@tslater I definitely spoke too soon, since I hadn’t tested the methods I had originally proposed. [Here is a new support question] ( I just raised that has a lot in common with what you’re trying to do. You can use the built-in weight for sorting, but like you, I’d like to extend my ability to sort.

Weight doesn’t apply to the taxonomies themselves, does it? Else where do you set the weight?

Taxonomies can be ordered by either alphabetical key or by the number of content pieces assigned to that key.

They can’t be ordered by a custom order though, can they?

Have you tried using the sort template function?

@tslater Do you have this code in a GitHub repo? If so, I might be able to take a better look at what you’re trying to do. Thoughts?