I recently received an email with the following question:
What is the simplest way for me to rename the categories Development and Golang into other names, like Projects and Gallery? Is this in partials or template or theme or where?
I figured that this might be a common question, so decided to share it in a blog post.
Here’s how to rename categories in Hugo, in the context of my theme.
How do I add and remove Categories in Hugo?
Categories are a kind of Taxonomy in Hugo.
The available categories are controlled by the Front Matter in each blog post - as soon as there exists a blog post with “Projects” or “Gallery” under Categories in the Front Matter, then it’ll become a category, and will turn up in the sidebar.
For example, here’s where “Development” is declared as a category:
If you were to remove all instances of “Development”, then it will no longer exist as a category.
How do I change the links in the top nav?
Secondly, I’ve created the partial top-nav-text-links.html which is what controls the category links in the header:
Create your own under layouts/partials/top-nav-text-links.html, and it will override the one in the theme themes/silhouette-hugo/layouts/partials/top-nav-text-links.html.. modifying the file directly will work too, and could be a first step in your experimentation.
Thanks for reading!
Did you enjoy this article? I hope this has been some help! Please share it on Twitter, Facebook, or Linkedin via one of the share links below.
Any questions, feedback, or anything that you think I’d be interested in? Please leave a comment below.