Hello,
How do I set an if isset a menu identifier ?
{{ range .Site.Menus.main }}
{{ if isset .Identifier }}data-id="{{ .Identifier }}"{{end}}
{{end}}
This is what I have so far, but it doesn’t seem to work. i looked at hugo documentation on conditionnels but only talks about params. https://gohugo.io/templates/introduction/#conditionals
Thank you!
Try something like this: isset .Params "comments"
. Otherwise Hugo don’t know what you’re looking for.
Another example:
{{ if (not (isset .Params "some_variable")) }}
do something
{{ end }}
Here’s one of my gists about isset
as well: https://gist.github.com/8994f2e05306b3248442382ca52ce4c8
Thank you, but in my post I talk about params already. I know how to isset with params, I don’t know how to isset a menu identifier.
I’m guessing this is impossible?