Menus in 0.55

Following the release of 0.55, my Site.Menus is completely empty. Menus that previously worked under 0.54 are no longer rendering. Has something changed in how menus work with this release?

Per the Menu documentation, I add the following front matter to my content:

menu: main

I then called a partial with {{ partial "nav" . }}

    {{ range .Site.Menus.main }}
            <a href="{{ .URL }}">{{ .Title }}</a>
    {{ end }}

…but nothing shows up execpt an empty <ul>. Just printing .Site.Menus.main or even .Site.Menus gives me an empty array.

What am I missing?

I’m hoping this leads to something as I have a related issue: 0.55 broke my menu

In case anyone is just reading this one, here are the issues I’ve encountered:

  • .Page.Params.x causing errors, $.Page.Params.x solves errors but being ignored even when parameters exist in frontmatter of content
  • weight: in frontmatter is being ignored for to-level (parent) pages. Children seem to still be respecting weight.
  • A content file directly under content/ is being ignored, despite having menu: main in its frontmatter.

Thanks for linking the topics, @bradbice.

In playing around with my site, I’ve noticed that only the file of a branch bundle is showing up in my menu. Anything else in the bundle, even if it has menu: main in the front matter, won’t be included. The home page (content/ is also not included in the menu.

So, a temporary workaround is to make everything branch bundles. Hardly a permanent solution, but at least it gets my menus showing again.

Are you able to get weight to work? That’s still being ignored for me.

Also, I’m unable to get a page in a branch bundle to be listed under menu: main as a parent-level item. For example, all of my bundle index pages are listing, but another one in content/folder/ with menu: main is ignored. Not even listed under Folder.

Version 0.55.1 seems to fix my menu problems. Everything shows up as expected in the menu, and weights are respected.

Thank you @bep and the Hugo Authors!


Awesome! Just waiting on Homebrew now… :wink: