How to directly query a Hugo config value within a template

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.

Regarding the use case described in the related topic, do it this way:
https://discourse.gohugo.io/t/hugo-v0-112-0-new-template-functions/44512

The punchline of the above topic is:

{{ strings.TrimPrefix hugo.WorkingDir .Page.File.Filename }}
2 Likes