Add to menu entry from theme's config.toml

I’m trying to add menu entries from a theme’s config.toml (seems to be possible according to documentation).

My current config + code:

  • include theme in my site’s config.toml

  • in config/_default/ , I have config.toml, languages.toml and a couple of language-specific menu config files (i.e. menus.en.toml). An example entry from my menus.en.toml would be

  url = "/"
  name = "Home"
  identifier = "home"
  weight = 1
  • in my theme’s config (/themes/theme-name/config/config.toml), I have
  name              = "Gallery"
  url               = "/galleries"
  identifier        = "gallery"
  weight = 3

And in my partial, which gets included in index.html, I range over menu entries as such:
(and I am passing in the page context to the partial)

<nav id="main_navigation">
      {{- $currentPage := . -}}
      {{ range .Site.Menus.main -}}
      <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
          <a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
      {{- end }}
  • pass theme config file to hugo ```hugo --config themes/theme-name/config/config.toml````


Only the menu entry in config/_default/menus.en.toml gets listed. The gallery menu entry will show up if I copy and paste it into my site’s config. I also tried renaming theme’s config.toml to menus.en.toml and make the corresponding adjustments for the menu declaration, but that didn’t work either.

I can’t figure out what I’m doing wrong, but the menu entry from my theme’s config file just won’t get included when I call .Site.Menus.main