Stefan Baumgartner

Web ops, performance and front-end

Jekyll filter: Use Liquid in front-matter

09 August 2016 by @ddprrt | Posted in: Jekyll

Jekyll’s template language Liquid is pretty powerful. We especially use Liquid objects to access different data across all pages, like

{{ }}

instead of the product name itself. However, we can’t use these objects in front-matter, where we would define titles and other meta information:

title: How to install {{ }}

Not possible. Well, not without a little help at least. Here’s a nice filter that parses Liquid objects when used within Jekyll front-matter:

module LiquidFilter
  def liquify(input)

Use it with

{{ page.title | liquify }}

Anywhere in your layouts.

Comments? Shoot me a tweet!