Search code examples
markdownjekyllliquid

Liquid Exception: Liquid syntax error (line 170): Unknown tag 'elif' in xyz for markdown code block


I use Jekyll to create my static website. One of my markdown has the following code block

....
```yaml
# Example pillar 'packages' YAML
{% if grains['os'] == 'RedHat' %}
apache: httpd
git: git
{% elif grains['os'] == 'Debian' %}
apache: apache2
git: git-core
{% endif %}
` ` `
...

However the generation of the site fails with

Liquid Exception: Liquid syntax error (line 170): Unknown tag 'elif' in

How would I properly escape such "code" that it is renderd properly and not interpreted as code.


Solution

  • {% raw %}
    ... any liquid or liquid-like code will be displayed as is.
    {% endraw %}