escaping liquid tags with {% raw %}

Jun 18, 2020

what i learned

you can use the tags raw and endraw to escape liquid tags.

how i learned

in the previous TIL i tried to write the following

i am moving soyserg.io from a hugo site to jekyll and i couldn’t figure out how to have nested {{}} as in {{ category/{{category | downcase }} | relative_url }} which just doesn’t work. so i moved to {{ 'category/' | append: category | downcase | relative_url }}

but it was not possible off the bat because of the double {}. at first i tried to escape them as \{\{\}\} but that did not work.

turns out the answer is the {% raw %} tag.

the paragraph then looks like this in the markdown file

`{% raw %}`
i am moving soyserg.io from a hugo site to jekyll and i couldn't figure out how to have nested `{{}}` as in `{{ category/{{category | downcase }} | relative_url }}` which just doesn't work. so i moved to `{{ 'category/' | append: category | downcase | relative_url }}`
`% endraw %`

Visit website

# jekyll # liquid tags