I have a beginner question but despite reading the docs I am still confused…
I want to generate the main menu for the header of my page via
# config.yaml
menu:
main
My (own) theme uses the following code to generate the header
<!--- relevant part from my themes/my_theme/layouts/partials/header.html file --->
{{ range .Site.Menus.main }}
<div class="text-center">
<a class="hover:text-lime-600 text-lime-800"
href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ .Title }}
</div>
{{ end }}
Now, the problem is that the menu works on the home page, but it is empty when I am not on the home page.
- Is
.Site.Menus.main
not referring to the one top-level menu but possibly only to menus of the current page bundle?
If so, how can I access the top-level menu?
PS: When I write out the menu explicitly in config.yaml, then it works on all pages. But I would like to learn how to do it without writing it out.
If relevant, the files in content are roughly like this
content/
_index.md
research/
_index.md
project_1.md
... (more .md posts)
cv
index.md
and I would like to see a menu with (home, research, cv) also in the generated research/index.html.