I recently had the need to list out a bunch of locations on a page with Hugo. With over 100 locations to display, I wanted to group them by state on the page creating a kind of directory. The first thing that came to mind was Hugo’s GroupBy function.
Unfortunately I’ve learned that the
GroupBy function only works on Hugo Pages while I’m storing all of these locations in a Hugo Data File.
Here’s how I solved this problem.