# How can I serve a static file with frontmatter?

**URL:** <https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690>\
**Category:** Help\
**Created:** [January 29, 2025, 7:01pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690 "2025-01-29T19:01:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dschep](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/dschep/32/6215_2.png) [@dschep](https://talk.jekyllrb.com/u/dschep)\
**Post date:** [January 29, 2025, 7:01pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/1 "2025-01-29T19:01:04Z")

</div>

I want to serve a file that contains frontmatter in a Jekyll powered site. I want the HTTP response to include the YAML frontmatter. As far as I can tell, Jekyll will always remove it which is unacceptable for my usecase. [As a temporarily workaround, as this site is hosted on Github Pages from a public repo, I’m using the raw.githubusercontent.com to load it directly from github](https://github.com/MapRVA/maprva.org/blob/3a4f3124e642e45e7a74e04255a9fc5b0235f8cc/_pages/maps/surveillance.md).

Context: these files are queries for [Ultra](https://overpass-ultra.us) which, like Jekyll, uses YAML frontmatter for configuration.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [January 29, 2025, 8:55pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/2 "2025-01-29T20:55:37Z")

</div>

If jekyll processes it I think it will remove any front matter - no way to stop it that I know of - so you need something else to maintain those files maybe? one way is you can tell jekyll to not nuke a folder in the \_site directory though that is hard to manage other than locally - and even then prone to error.

You could have something else copy the files into the \_site folder for - like gulp or npm, some sort of build process that could run after jekyll.

Your work around might be the simplest though.

Does the Ulta thing allow other delimiters besides the 3 dashes? I think some things allow other things like 3 ~'s?

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [January 29, 2025, 8:58pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/4 "2025-01-29T20:58:34Z")

</div>

ah - maybe I am thinking it is 3 dashes - but yaml is different, hopefully that is the answer!

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [January 29, 2025, 9:26pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/6 "2025-01-29T21:26:21Z")

</div>

One workaround is to use `raw` to quote the file contents. This will produce the correct output:

```auto
---
---
{% raw %}---
type: overpass
....
out geom;{% endraw %}

```

---

<div class="post-metadata">

**Author:** ![dschep](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/dschep/32/6215_2.png) [@dschep](https://talk.jekyllrb.com/u/dschep)\
**Post date:** [January 30, 2025, 4:01pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/7 "2025-01-30T16:01:51Z")

</div>

I found [jekyll-include-raw | Jekyll Themes](https://jekyll-themes.com/klandergren/jekyll-include-raw) which gets me a similar approach to your suggestion @chuckhoupt. Haven’t actually decided if it’s worth it, but it’s an option.

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [February 3, 2025, 2:10am UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/8 "2025-02-03T02:10:03Z")

</div>

If you’re able to use 3rd party plugins, then there may be plugins for copying files unmodified. For example (I haven’t tested it):

> **[GitHub - boyvanamstel/jekyll-copyr: A Jekyll plugin to easily copy files from anywhere...](https://github.com/boyvanamstel/jekyll-copyr)**
>
> A Jekyll plugin to easily copy files from anywhere into your site.

---

<div class="post-metadata">

**Author:** ![dschep](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/dschep/32/6215_2.png) [@dschep](https://talk.jekyllrb.com/u/dschep)\
**Post date:** [February 3, 2025, 10:53pm UTC](https://talk.jekyllrb.com/t/how-can-i-serve-a-static-file-with-frontmatter/9690/9 "2025-02-03T22:53:57Z")

</div>

That worked like a charm @chuckhoupt! Thank you. [https://github.com/MapRVA/maprva.org/commit/76eb1cd1bc8c022399f578e38f89917b98c97056](https://github.com/MapRVA/maprva.org/commit/76eb1cd1bc8c022399f578e38f89917b98c97056)
