Here’s a simple way to organize your taxonomies and have a bird’s eye view of the number of posts per category/tag in Hugo.
The Problem
As techformist.com grew, I became more and more disorganised in maintaining taxonomies. I had some interesting situations -
- a “static-site” category coexist with “static sites” category
- confusion b/w why I chose a few terms to be tags rather than categories in their own right
- the recurring need to “rethink taxonomy structure” depending on the flavour of the month and time of the day
This often required me to go back and change a few taxonomy terms, or to reorganize site structure in order to provide better visibility to chosen topics.
I also developed this habit of referring back to the older topics with a site search / VSCode search just to copy/paste tags and categories from an older post.
This was frustrating.
The Solution
There were couple of simple solution options -
- Create a summary page on the site
- Include counts in the manually maintained writing/editorial calendar (and bring some automation to that side of the world while at it)
- Analyse sitemap to get a nice summary and maintain that analysis somewhere
In the end, I felt it would be easier to create a quick summary page on the site and refer back to it, rather than over-engineer a solution.
So, I created this summary page with just a few lines of code for layout.
I can now -
- Quickly check the categories / tags and select relevant combination for a new post
- Keep an eye on the counts and refocus on things that I have to write more about
- Satisfy my ego by showing the post counts and by hiding away more useful statistics such as the usefulness & longevity of the content
How to implement this in your own Hugo site?
Create a file called “summary.html” in your layouts
folder.
|
|
As you can see, I am no where near an expert on Hugo. Or, even basic styling in HTML :)
Next, create a content page in pages
folder. This is to better organize structure in the future.
|
|
Navigate to <your site>/summary
.
Have fun.