-
|
I would like the menu in the sidebar not to be automatically generated based on folders and files from content, instead I would like to control it with a menu.en.toml file from config. The official Hugo documentation for having a menu for each language explains that I can create these files: with this content (for menus.en.toml): [[main]]
name = 'Products'
pageRef = '/products'
weight = 10
[[main]]
name = 'Services'
pageRef = '/services'
weight = 20So I did a test with a fresh new site: and this menus.en.toml: [[main]]
name = "Test 1"
pageRef = "#"
weight = 1
[[main]]
name = "Test 2"
pageRef = "#"
weight = 2
[[shortcuts]]
name = "Other 1"
pageRef = "#"
weight = 1
[[shortcuts]]
name = "Other 2"
pageRef = "#"
weight = 2The result in the sidebar is:
Why can't I override the automatic menu generation? How do I make Test 1 and Test 2 appear in the main section instead of About us and Map? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
You need to redefine your sidebar menus. See https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/menus/index.html#defining-sidebar-menus Something like this: [params]
[[params.sidebarfootermenus]]
type = 'divider'
[[params.sidebarfootermenus]]
identifier = 'footercontrols'
type = 'custom'
[[params.sidebarfootermenus.elements]]
type = 'historyclearer'
[[params.sidebarfootermenus.elements]]
type = 'variantswitcher'
[[params.sidebarfootermenus.elements]]
type = 'languageswitcher'
[[params.sidebarheadermenus]]
type = 'divider'
[[params.sidebarheadermenus]]
disableTitle = true
identifier = 'homelinks'
type = 'menu'
[[params.sidebarheadermenus]]
type = 'divider'
[[params.sidebarheadermenus]]
identifier = 'headercontrols'
type = 'custom'
[[params.sidebarheadermenus.elements]]
type = 'versionswitcher'
[[params.sidebarheadermenus]]
type = 'divider'
[[params.sidebarmenus]]
disableTitle = true
identifier = 'main'
type = 'menu'
[[params.sidebarmenus]]
disableTitle = false
identifier = 'shortcuts'
type = 'menu'Note The difference is in the second last section in comparison to the default configuration taken from the docs. |
Beta Was this translation helpful? Give feedback.
-
|
I had read that document but for some reason I thought it did not apply to me. Thank you very much! 🙏 |
Beta Was this translation helpful? Give feedback.
You need to redefine your sidebar menus. See https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/menus/index.html#defining-sidebar-menus
Something like this: