Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom menus not working after upgrading to v0.84 #8672

Closed
anthonynelzinsantos opened this issue Jun 19, 2021 · 6 comments · Fixed by #8691
Closed

Custom menus not working after upgrading to v0.84 #8672

anthonynelzinsantos opened this issue Jun 19, 2021 · 6 comments · Fixed by #8691
Assignees
Milestone

Comments

@anthonynelzinsantos
Copy link

My custom menus broke after upgrading to Hugo v0.84. They’ve been working fine for years, I didn’t change a thing in my config:

menu:
    header:
        - identifier: "À propos"
          name: "À propos"
          url: /a-propos/
          weight: 1
        - identifier: "Commencez ici"
          name: "Commencez ici"
          url: /commencez-ici/
          weight: 2
        - identifier: "Défileur"
          name: "Défileur"
          url: /defileur/
          weight: 3
        - identifier: "Guide orthotypographique"
          name: "Orthotypo"
          url: /guide-orthotypographique/
          weight: 4
        - identifier: "Mentions légales"
          name: "Mentions légales"
          url: /mentions-legales/
          weight: 5
        - identifier: "RSS"
          name: "RSS"
          url: /index.xml
          weight: 6

Nor did I change a thing in my templates:

<div class="menu_pages">
	{{ range .Site.Menus.header }}
		<p><a href="{{ .URL }}">{{ .Name }}</a></p>
	{{ end }}
</div>

I know that v0.84 changed some things about the merging of params, but I don’t see how it could affect me. I tried to debug using {{ printf "%#v" .Site.Menus.header }}, but it simply returns nil. I’m at a loss of ideas.

What version of Hugo are you using (hugo version)?

hugo v0.84.0+extended darwin/arm64

Does this issue reproduce with the latest release?

Yes.

@anthonynelzinsantos
Copy link
Author

@bep
Copy link
Member

bep commented Jun 19, 2021

Could you try to rename the config from menu to menus? We changed that long time ago; we did have a way to make it backwards compatible, but that may have broken in my "config rewrite".

@anthonynelzinsantos
Copy link
Author

Unfortunately, it looks like it doesn’t work.

@jmooring jmooring added the Bug label Jun 19, 2021
@jmooring
Copy link
Member

jmooring commented Jun 19, 2021

Confirmed.

With v0.83.1 this worked:

[languages.en]

[[menus.foo]]
name = "foo-a"
url = "/foo-a/"

[[menus.foo]]
name = "foo-b"
url = "/foo-b/"

With v0.84 you must do this instead:

[languages.en]

[[languages.en.menus.foo]]
name = "foo-a"
url = "/foo-a/"

[[languages.en.menus.foo]]
name = "foo-b"
url = "/foo-b/"

Minimal reproducible example:

git clone --single-branch -b hugo-github-issue-8672 https://github.com/jmooring/hugo-testing hugo-github-issue-8672
cd hugo-github-issue-8672
hugo server

@jmooring
Copy link
Member

This may have been the same problem: #8649

@bep bep added this to the v0.84.1 milestone Jun 21, 2021
mrdrogdrog added a commit to hedgedoc/hedgedoc.github.io that referenced this issue Jun 22, 2021
Hugo 0.84.0 has a bug where menus with custom entries won't get rendered. See gohugoio/hugo#8672

Signed-off-by: Tilman Vatteroth <[email protected]>
DerMolly pushed a commit to hedgedoc/hedgedoc.github.io that referenced this issue Jun 22, 2021
Hugo 0.84.0 has a bug where menus with custom entries won't get rendered. See gohugoio/hugo#8672

Signed-off-by: Tilman Vatteroth <[email protected]>
@bep bep self-assigned this Jun 22, 2021
bep added a commit to bep/hugo that referenced this issue Jun 24, 2021
@bep bep closed this as completed in #8691 Jun 24, 2021
bep added a commit that referenced this issue Jun 24, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants