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:
Level1/level2/post.md
Level1/level2/level3/other.md
Level1/level2/level3/level4/more.md
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
- Level4
- Other
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,
Jeremy