HUGO

Migration from Hugo 0.18 to latest version

Hello!

I’m now in charge of an old website created some years ago by using Hugo 0.18…
I have to add and update some content.

Almost everything is still working when I’m using the Hugo 0.74.3 version (amazing job btw) but I still have an issue and I cannot figure out how to solve it.

The website is translated in 2 langages.
I have the following folders hierarchy:
hierarchy

In the index.html, I have the following code to display the menu based on page in “content/menuhome”:

{{ range where .Data.Pages “Section” “menuhome” }}
{{ if isset .Params “link” }}<a href="{{ index .Params “link” }}"{{else}}<a href="#{{.File.TranslationBaseName }}"{{end}} {{ if isset .Params “newpage” }}target="_blank"{{end}}>

{{ if .GetParam “sectiontitle” }}{{ .GetParam “sectiontitle” }}{{ else }}{{ .Title }}
{{ .Content }}{{ end }}
{{ end }}

With this code compiled by Hugo 0.18, my index page has 3 items in the menu (catalogue, private and pro) but unfortunately with the latest Hugo version my menu is empty…

Any idea how I can solve this?

Already thank you!

You might want to have a look at the various .Pages variables and what the differences are: https://gohugo.io/variables/site/#sitepages-compared-to-pages

You probably want something like where .Site.RegularPages "Section" "menuhome".

This was the right solution, thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.