# How to directly query a Hugo config value within a template

**URL:** https://discourse.gohugo.io/t/how-to-directly-query-a-hugo-config-value-within-a-template/46207
**Category:** support
**Created:** [September 14, 2023, 3:12pm UTC](https://discourse.gohugo.io/t/how-to-directly-query-a-hugo-config-value-within-a-template/46207 "2023-09-14T15:12:07Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [September 14, 2023, 4:05pm UTC](https://discourse.gohugo.io/t/how-to-directly-query-a-hugo-config-value-within-a-template/46207/2 "2023-09-14T16:05:42Z")

</div>

> [@salim](#):
>
> But I wonder why it doesn’t seem possible to directly query a Hugo config value

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](https://discourse.gohugo.io/t/hugo-v0-112-0-new-template-functions/44512)

The punchline of the above topic is:

```plaintext
{{ strings.TrimPrefix hugo.WorkingDir .Page.File.Filename }}

```

---

_[View the full topic](https://discourse.gohugo.io/t/how-to-directly-query-a-hugo-config-value-within-a-template/46207)._
