Question about menus (solved)

I was able to create a menu without too much trouble thanks to a number of tutorials, but I would like to create two menus - a main menu and a footer menu.

So the main menu would be {{ range .Site.Menus.main }}

I was hoping that the footer menu would be {{ range .Site.Menus.footer }}

… that didn’t work. In the front matter I used the [menu] and then [[menu.footer]]

I tried looking in the docs but as a beginner, they’re a little confusing. Would someone mind explaining where I’m going wrong or point in the direction of docs that explain this.

Thanks all

Never mind, figured it out thanks :fu:

1 Like

How? Would be nice to share your solution for others to learn…

Ok, I’m sure most people know how to do this already, but for those like me that are new to Hugo - this is how I got two menu’s going.

I wanted a traditional “nav” menu and I wanted a separate “footer” menu. Turns out it was simpler than I thought. In the config.toml file where you create your menu, you use the parameter

[menu]

followed by what I assume is the menu name (in this case, main).

[[menu.main]]

To create a footer menu I simply named the menu “footer” so…

[[menu.footer]]

and then added the usual “name”, “url” and weight “values”.

When calling the menu, instead of

{{ range .Site.Menus.main }}

I called the “footer” menu like so…

{{ range .Site.Menus.footer }}

And that’s how I did it. I’m not sure if it’s the correct way, but it’s working for the time being.

1 Like