But I wonder why it doesn’t seem possible to directly query a Hugo config value. This is relevant for config keys that are not custom params and have no (direct) representation in site variables like defaultContentLanguageInSubdir. There are lots more it appears to me, e.g. it would allow to test if buildDrafts or buildFuture is active without relying on workarounds.
When we expose a value to the templates we are making an API promise: “Here’s this new thing. Use it to do xyx. And you can be confident that we won’t change how it behaves in the future.”
In short, it locks us into something, which may prevent us from doing something else in the future without first going through deprecation/sunset process.
So we expose what is needed to satisfy common requirements, but push back on others.
And we do this stuff fairly often, most commonly is that we change bool config settings into structs if we need more fine grained config for a particular topic. It’s easy to maintain backward compability on the config level, but it would be (almost) impossible if these settings were also used in thousands of templates in the wild.