# Does a .yaml file (for headers) can process partials?

**URL:** <https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075>\
**Category:** support\
**Created:** [October 27, 2020, 5:25pm UTC](https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075 "2020-10-27T17:25:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![divinerites](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/divinerites/32/12625_2.png) [@divinerites](https://discourse.gohugo.io/u/divinerites)\
**Post date:** [October 27, 2020, 5:25pm UTC](https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075/1 "2020-10-27T17:25:21Z")

</div>

I’m setting up the option for `hugo server` headers in dev mode.  
It works well and it is really cool to see right away what is happening without going live.

But for Netlify, I use `index.headers` and `outputFormats.HEADERS` so I can use partials to generate my custom CSP.

But `config/development/server.yaml` doesn’t seems to go thru the templating engine (wich make sense). So I get the literal template call and not the result.

Is there any possibility/workaround/tip to have my `hugo server` dev headers evaluating my partial ?

#### config/development/server.yaml =\> do not evaluate my partial

```auto
headers:
- for: /**
  values:
    Referrer-Policy: strict-origin-when-cross-origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-XSS-Protection: 1; mode=block
    Content-Security-Policy: script-src localhost:1313 'self' {{ partial "plausible_csp.html" . }}; frame-src 'self' https://umap.openstreetmap.fr https://www.youtube.com; default-src 'self'; manifest-src 'self'; connect-src 'self' {{ partial "plausible_csp.html" . }}; font-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; form-action 'none'; base-uri 'none'; object-src 'none'

```

#### index.headers =\> evaluate correctly my partial

```auto
/*
  Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  X-Frame-Options: SAMEORIGIN
  Referrer-Policy: strict-origin
  Feature-Policy: geolocation 'self'
  Permissions-Policy: geolocation=(self), microphone=()
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  Content-Security-Policy: script-src 'self' {{ partial "plausible_csp.html" . }}; frame-src 'self' https://umap.openstreetmap.fr https://www.youtube.com; default-src 'self'; manifest-src 'self'; connect-src 'self' {{ partial "plausible_csp.html" . }}; font-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; form-action 'none'; base-uri 'none'; object-src 'none'

```

---

<div class="post-metadata">

**Author:** ![gethugothemes](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gethugothemes/32/13287_2.png) [@gethugothemes](https://discourse.gohugo.io/u/gethugothemes)\
**Post date:** [November 1, 2020, 4:38am UTC](https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075/2 "2020-11-01T04:38:56Z")

</div>

How about putting the partials you want to use in development into a module that is only loaded in development and then using `.Site.isServer` to check if you are on development environments?

---

<div class="post-metadata">

**Author:** ![divinerites](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/divinerites/32/12625_2.png) [@divinerites](https://discourse.gohugo.io/u/divinerites)\
**Post date:** [November 1, 2020, 7:11am UTC](https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075/3 "2020-11-01T07:11:56Z")

</div>

Thanks Mehedi, but I was not clear.

My question was about : _does a .yaml file (for headers) can process partials ?_. And the response at the moment seems to be no.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [November 3, 2020, 7:11am UTC](https://discourse.gohugo.io/t/does-a-yaml-file-for-headers-can-process-partials/29075/4 "2020-11-03T07:11:59Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
