Menus in 0.55

#1

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" . }}

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

…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?

0 Likes

#2

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.
0 Likes

#3

Thanks for linking the topics, @bradbice.

In playing around with my site, I’ve noticed that only the _index.md 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/_index.md) 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.

0 Likes

#4

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/page.md with menu: main is ignored. Not even listed under Folder.

0 Likes

#5

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!

1 Like

#6

Awesome! Just waiting on Homebrew now… :wink:

0 Likes