Creating Multiple Sidebar Menus by Product

I would like to have multiple sidebar menus so that when a user selects a product from a drop down in the top nav, they will open the sidebar and content for that product.

Does anyone know if this can be done in Hugo? Tom Johnson was able to do it in his Jekyll Documentation theme using yaml files to store the different menus.

I have tried creating menus in yaml files and adding them to the data folder, but I am having a hard time pulling the key value pairs from the map that is generated when I have Hugo range over them.

Here is my code:
{{ $map := .Site.Data.Sidebars.dspConduct.overview }} {{ range $elem_key, $elem_val := $map }} <ul class="uk-nav-default uk-nav-parent-icon" uk-nav> <li> <a href="{{ $elem_val | relURL }}">{{ $elem_key }}</a> </li> </ul> {{ end }}

Using the example from the Introduction to templates topic in the Hugo docs, this code works but only if there is only one level of depth. I can’t seem to get it to work for multiple levels.

This thread may be helpful: Menu with unlimited levels

1 Like