Search code examples
templatesliquid

How to escape liquid template tags?


This sounds very easy, however I couldn't find it anywhere in the docs. How can I write {% this %} in a liquid template, without it being processed by the engine?


Solution

  • For future searchers, there is a way to escape without plugins, use the code below:

    {{ "{% this " }}%}
    

    and for tags, to escape {{ this }} use:

    {{ "{{ this " }}}}
    

    There is also a jekyll plugin for this which makes it a whole lot easier: https://gist.github.com/1020852

    Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}

    Reference