How to Display Liquid Templates in Code Blocks in Jekyll
●
Permalink
●
suggest edit
Every now and then, I want to post a sample code block for my blog that displays a liquid template. However, if I simply paste in a liquid template, it will be rendered.
Then I found the {% raw %} and {% endraw %} tags. So, you may want to wrap your source like so:
1
{% raw %}{% include foobar.html %}{% endraw %}
This will display a proper code sample in your post like so:
1
{% include foobar.html %}
While you really only need to put the first {% inside a raw tag to escape, I have a habit of also following with the last %} as well.
Jason N. Gaylord
