Anyway to inject variables into frontmatter?

Hi I’ve researched this topic and it doesn’t seem like what I want to do is possible.

I’m trying to use liquid variables in the front matter.
I’ve tried a few sites to get around this issue – mostly


https://fettblog.eu/snippets/jekyll/liquid-in-frontmatter/

All these sites are a couple of years old and I can’t seem to make them work either.
Are there any solutions?

Hmm interesting idea. I haven’t come across that before.

Well that gem shows that it certainly is possible. Can you share in what way that broke if it did not install or gave unexpected output or errors? If its dependencies are locked down and the Jekyll version from that time is known you could try it out with older jekyll added to Gemfile.

Its possible there was security or performance vulnerability which means it’s not practical anymore.

Consider how to frame you problem mentally without using frontmatter or liquid.

You might find that the logic in frontmatter might be suitable to put in a custom filter (write a ruby plugin) or an includes file (html snippet which can take multiple parameters).

Also not that an includes file doesn’t need explicit arguments given. You could call you includes file which can pick up the title from the page and argument at the point you want to insert the snippet. If you have a text like 'Welcome to` then that could go in the snippet or even as a parameter to the includes file. So you give the preamble and page.title to includes file and the includes file them together in using html and liquid.