Hello!
My Hugo builds crash dramatically under some conditions related to menus. I would like to know if that’s reproducable for others or just expected behavior because I made something wrong or because my environment is too weak.
- Win 10/64 with WSL1/Debian.
- Test repo that I’ve tested with Hugo version 0.97.3: https://github.com/GHSVS-de/menu-test
- Same behavior in a larger Hugo repo with Hugo version 0.98.0
- I found this tipp and wanted to fiddle with it: Search menu with Where? - #2 by jmooring
- I created a menu named
main
in config.toml: https://github.com/GHSVS-de/menu-test/blob/main/config.toml#L5-L17 - I added this line
<pre>{{ jsonify (dict "indent" " ") site.Menus.main }}</pre>
in layoutlist.html
. - Started
hugo server
or justhugo
(with some flags or without). - Output on rendered Home page like expected:
[
{
"ConfiguredURL": "/about/",
"Page": null,
"PageRef": "",
"Name": "about hugo",
"Menu": "main",
"Identifier": "about",
"Pre": "\u003ci class='fa fa-heart'\u003e\u003c/i\u003e",
"Post": "",
"Weight": -110,
"Parent": "",
"Children": null,
"Params": null
},
{
"ConfiguredURL": "/getting-started/",
"Page": null,
"PageRef": "",
"Name": "getting started",
"Menu": "main",
"Identifier": "",
"Pre": "\u003ci class='fa fa-road'\u003e\u003c/i\u003e",
"Post": "\u003cspan class='alert'\u003eNew!\u003c/span\u003e",
"Weight": -100,
"Parent": "",
"Children": null,
"Params": null
}
]
Now comes the weird part:
- I added an additional frontmatter
menu: main
in filecontent/menutest.md
. - Started
hugo
orhugo server
(with some flags or without). - After a console message
Start building sites …
hugo v0.97.3+extended linux/amd64 BuildDate=unknown
WARN 2022/04/28 23:01:13 .Path when the page is backed by a file is deprecated and will be removed in a future release. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:
{{ $path := "" }}
{{ with .File }}
{{ $path = .Path }}
{{ else }}
{{ $path = .Path }}
{{ end }}
Re-run Hugo with the flag --panicOnWarning to get a better error message.
the process crashes with many error messages. I can only provide the last 300 lines because the buffer of my console is too small for all: https://github.com/GHSVS-de/menu-test/blob/main/error.txt
- I understand that it has something to do with the Page that I’ve added to the menu but why
- When I output the menu with
range
all three items are present.
Thank you!