I have a specific page that I don’t want to include in .Site.Menus.Main. I’m a complete beginner at Hugo. I’ve tried:
menu = ['none']
and
menu = []
in my front-matter but neither has worked. Any ideas?
I have a specific page that I don’t want to include in .Site.Menus.Main. I’m a complete beginner at Hugo. I’ve tried:
menu = ['none']
and
menu = []
in my front-matter but neither has worked. Any ideas?
Do you want it to be removed from only a single content page or do you generally want to remove it from the menu? Did you check the config and saw if the menu is defined there? I guess you’re using a premade theme so you need to stick to the configuration guide there. The menu in the front matter is for defining content-specific menus but the theme must support it by using the parameter variables (don’t know how hugo exactly handles menus defined by front matter, didn’t use it yet)
Should nothing help, please share your source so we can see what you’re using in order to help you
My theme is a slightly-modified version of ananke
. basically does the following:
{{ range .Site.Menus.main }}
<li>
<a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ .Name }} page">
{{ .Name }}
</a>
</li>
{{ end }}
So I basically want to remove a single page from .Site.Menus.Main
.
As I said, did you check the config file? Normally most themes define their menus there. Removing the entry from there will remove it from menu. If you only want to remove it from the menu when a special condition is met, you would need to check if the current url is the one you want and then you need to check the name of each menu item if it’s the one which should be skipped. Unfortunately it’s not 100% clear which way you want to go, so could you explain it a bit further?
Take the menu line completely out of the frontmatter, and check that there is no menu commands in the common config.toml
as well?
The only mention of menus in config.toml
is:
SectionPagesMenu = "main"
Remove the sectionPagesMenu = main
from your config.toml, then define only the menus that you do want included.