When you run a dev blog on Hugo (PaperMod theme), a static site generator, you'll eventually want to add posts that go beyond tech write-ups -- daily life, travel, book reviews, and more. Here's how to set up a categories classification system so readers can easily browse the category they're interested in.
1. Adding Categories to the Top Menu in hugo.yaml
Add the entries below to the menu.main section of your hugo.yaml config file so a link to the categories page shows up in the blog's top navigation bar.
menu:
main:
- name: Categories
url: /categories/
weight: 10
- name: Tags
url: /tags/
weight: 20
weight number, the further left (higher priority) the item is placed in the menu.
2. Specifying Categories in the Front Matter When Writing a Post
When writing a new post, specifying a categories array in the front matter at the top of the post lets Hugo automatically sort it into the corresponding category page at build time.
π» Example: A Dev Post
---
title: "[C++] Deep Dive into Real-Time HTS Quote Processing"
date: 2026-07-29T09:10:00+09:00
draft: false
categories: ["DevLog", "CPP"]
tags: ["C++", "HTS", "Lock-free"]
---
βοΈ Example: A Travel/Life Post
---
title: "[Travel Log] A Packed 5-Day, 4-Night Singapore Itinerary and Local Tips"
date: 2026-07-29T10:30:00+09:00
draft: false
categories: ["Life", "Travel"]
tags: ["Travel", "Singapore", "Daily Life"]
---
3. Using Multiple Categories and Their Benefits
Hugo lets a single post belong to several categories at once, like categories: ["Life", "Travel"].
β’ Helps with Google AdSense review: a well-organized site structure improves accessibility for crawler bots
β’ Boosts reader experience (UX): both tech readers and lifestyle readers can pick out exactly the topics they want
β’ Diversifies search traffic: more casual weekend/evening searchers come in, driving up pageviews
4. Conclusion
Just by registering the menu in hugo.yaml and setting categories in the front matter, you can neatly tidy up your blog's structure. Build a flexible blog that keeps its technical edge while also making room for a rich record of daily life and travel!