# Hugo: Section Sorted by Taxonomy

## i'm probably doing this the hard way

One of the other weird-ish things I needed to be able to do for this site setup was the Projects page over there to the side. It’s the section page for the Project section, and on it I wanted to sort all my project posts, and only my project posts, by some sort of assigned type, rather than listing by date or whatever.

I’m doing this the cheaty way by just using the ‘tags’ taxonomy for blog posts, and using the ‘categories’ taxonomy only for project posts. I didn’t just want to link to the taxonomy list page, because then I would have to fiddle with the page name and title and whatnot to make it what I wanted. This meant that I needed to pull the full “category” taxonomy listing into the “project” section list template.

In the /layouts/project/project.html template file I have this in the main content <div>:

<section>
{{ range $key,$value := $.Site.Taxonomies.categories }} <h2> {{ humanize$key }} </h2>
<ul>
{{ range \$value.Pages }}
{{ .Render "li" }}
{{ end }}
</ul>
{{ end }}
</section>


It took surprisingly long for me to find a bit of sample code to modify for this, so here’s hoping I’ve provided another potential search result for someone trying to figure this out. The ‘humanize’ bit in there is because I am difficult and I like capitalization in my organizational structure.

This is using Hugo version 0.37.1 at the time of writing.