I don’t know anything about golang, so the following might be completely obvious and redundant, apologies if that’s the case.
I tracked down a little bug in a site I’m building that was caused by the following behaviour, which I’m pretty sure is undocumented:
[menu]
[[menu.main]]
title = "first item"
url = "https://example.com/first"
post = "whatever description"
[[menu.main]]
title = "second item"
url = "https://example.com/second"
post = "whatever other description"
Only one of these items will show up in .Site.Menus.main
. However, when each item has at least one of name
or identifier
defined, both will appear. I haven’t tested all the variations of this, since I’m sure this behaviour is known. But there’s no reference to it in the current version of the docs, so far as I can tell. I was only able to solve the problem by working backwards from the example menu-entries given in the docs.
I suppose this happens because whatever entity the above toml
is parsed into (or the parser itself, idk) depends on the presence of at least one of name
or identifier
(perhaps there are other alternatives?) to distinguish between menu items. If I had more golang under my belt I’d be less lazy and go and look for the implementation, but I don’t have time for that just now. My question for the moment is: what exactly is the constraint here, and shouldn’t it be clearly stated in the documentation? i.e.
note that every non-content menu item must have at least one of the properties
name
oridentifier
that’s all! if it’s a good idea I’ll make my first pull request to the documentation.