Menu with up to 4 levels of navigation

Hi there,

I’m very new to Hugo and I’m trying to create my own template for a specific need. My requirement is to be able to organize content in folder up to 4 levels:


I would like then to be able to build a navigation menu from this

  • Level1 (could be another name than “Level1” that is used in the filesystem path)
    • Level2
    • Post
    • Level3
      • Other
        • Level4
          • More

I’m thinking about having specific metadata in the YAML of each file. Something like

title = "Post"
level1 = "XXX"
level2 = "YYY"
level3 = "ZZZ"
level4 = “AAA”

Two questions:

  • Do this approach seems reasonable ?
  • How I can build a menu from those metadata ?

I took a look at multiple existing theme and I tried to understand how to use the template syntax but I didn’t find the way to implement this. I’m able to read the top sections and the metadata but I don’t know how to “group” them to build the menu.

Thanks for your help,


Use the built-in menu system in Hugo.

Thanks for the quick feedback. I’ve seen that doc before but what is unclear for me is what is in the config.toml vs what is in the .md file itself.

I would still recommend taking the path known to work instead of walking down some complex and dark alley that is probably not gonna get you anywhere close to where you want.

I have written at length about the menu system in here, use the search. But I can add that this will be easier to grasp in Hugo 0.18, when everything is a page an can have frontmatter with a menu definition.