In theme templates, is there any way to determine whether config parameter disableHugoGeneratorInject was set in hugo.toml of the site that makes use of my template?
Something like:
{{ if not site.Config.disableHugoGeneratorInject }} <-- .disableHugoGeneratorInject does not exist!
{{ hugo.Generator }}
{{ end }}
No, but you don’t need to specifically insert {{ hugo.Generator }} either. If disableHugoGeneratorInject is false or unset, Hugo will insert the meta tag on the home page.
In my case a theme deliberately inserts hugo.Generator on all pages, not only on the home page.
Now a user set disableHugoGeneratorInject to true and complains that the theme disregards this setting and unconditionally inserts a generator tag. Of course I can evaluate an additional setting like disableHugoGeneratorInjectAllPages from site.Params, but this is somehow an unwanted duplication. That’s the reason why I asked.
Yes, I see. This thread was actually meant as an attempt to find a way to overcome this unfortunate shortcoming, but there seems to be no way right now. What about exposing the disableHugoGeneratorInject setting in a future version of hugo so that it can be used in templates? Certainly not a pressing problem, but nice to have IMHO.