How do you make Jekyll execute Liquid variables in front matter


Hi, I’m trying to call Liquid values into my layout/include front matter. But usually Jekyll outputs it raw without executing it.

Say I got

title: Welcome to {{ site.title }}

I’d expect the output to be “Welcome to My Website”; instead I get “Welcome to {{ site.title }}”, meaning the Liquid tag isn’t executed.

Is there a way to get this done?



Pretty sure liquid is not allowed in the front matter.


So, I wonder is this a bug or a feature…and I’m really curious to find a way around it because it’s increasingly becoming a need for my use cases…it’s why I posted it here in such detail…


I think it is intended behavior based on the order of how things are render would be my guess.

Your example is very simple, is there something else you are trying to accomplish? for example, if you are using title for the Title in the Head, then you can use an include and use liquid there to insert the site.title.

First answer here has a clever solution that may work:


Thanks, @rdyar, so this Liquid’s replace filter method did work in exactly the same way as used, with !SITE.URL!. I supposed I can try it with other variables, too. But I just wish there was a way to get around it automatically…

I mean, at ease, I’d love to just drop variable calls/placeholders even while in front matter…


yeah, that was hacky but outside the box thinking.

I’m sure others would like the same thing, but I’m guessing it is not easy to accomplish.


While Liquid isn’t allowed in Frontmatter out of the box, there’s a fairly simple plugin you can use to get around this. This blog post contains examples and the code you need, but all you need to do is add a Liquid filter to your variables to output the actual variables of the thing you’re referencing.

For your example, this won’t work to render the actual title (the one displayed as the title of a tab in a browser, etc), but it will work for rendering content on the pages themselves. For example:


title: "My Website"

title: "Welcome to {{ site.title }}"

{{ page.title | flatify }}

This would output Welcome to My Website.

It isn’t perfect, but I’ve found this to be really helpful overall!


Thanks, @erinkcochran I’ll take a look at the post, implement the suggested plugin and hope it works…is this something Jekyll could consider making possible within its core in future?



O, my God, finally a solution that worked, nifty! Thanks very much @erinkcochran


You’re welcome! It’d be super if the Jekyll team would implement it within the core. An issue was recently opened on the repo that asks for this to be a core feature - go pile on!



This not work for me. I’m using jekyll 3.8.2. Any suggestions? Tks.


Interesting. Why not, though, can you share snippets of your code, perhaps where you feel the issue may be coming from? I’d be glad to take a look.


@kblife @erinkcochran
Sorry, this work for me too! I forgot “| flatify”


@bmr It looks like your post was withdrawn - did you manage to figure out the issue? I’m happy to help if I can!