Thanks for your reply,
but the main problem is not that the param is stored in lowercase or can be accessed caseinsensitive (here you get the expected result with the camel-cased access.)
But that the functions like isset (or index) fail when using the exact declaration as in the config.
This is inconvenient and a big pitfall. I’m not so familiar with hugos architecture yet, but if the functions are declared within the hugo framework, then I would adjust them to work with the parameters I declare and not to have the knowledge about the lowercase map behind the scenes. Or introduce appropriate parameter specific ones.
Thanks to your search link I stumbled upon this old post, that has the same issue, with people falling down the same pitfall
https://discourse.gohugo.io/t/config-params-should-be-all-lowercase-or-not/5051
Understanding correctly, the isset behaviour was seen as unintended back then, but wasn’t fixed since.
However I overlooked that the behaviour is in fact documented.
I just visited the isset page, where it’s explicitly mentioned:
All site-level configuration keys are stored as lower case. Therefore, a
myParam
key-value set in your site configuration file needs to be accessed with{{if isset .Site.Params "myparam"}}
and not with{{if isset .Site.Params "myParam"}}
. Note that you can still access the same config key with.Site.Params.myParam
or.Site.Params.myparam
, for example, when usingwith
.
But IMO this behaviour is bad practice nontheless. Also taking in consideration, that camelCase is used in all config files I stumbled upon (e.g. Configure Hugo | Hugo).