Showing Curly Brackets in Liquid Templates

13 years ago - #Jekyll#Liquid

As I started creating new tech entries on my site, I ran into the problem of writing samples of liquid template code. Liquid kept trying to translate my sample code into actual code.

So this:

{% highlight html %}
{% for post in paginator.posts %}

<div class="teaser clearfix">
  <div class="title"><a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></div>
  <div class="meta"><span class="timeago">{{ post.date | time_ago }}</span>{{ post.tags | tag_links }}</div>
  <div class="description">{{ post.description }}</div>
</div>

{% endfor %}
{% endhighlight %}

...was causing errors because the template kept trying to translate the for loop into code.

It turns out that all you have to do is put this after the highlight tag:

{% raw %}
...lots of liquid code goes here and it doesn't get interpreted...
{% endraw %}
blog comments powered by Disqus
One of the features that I needed to add to Jekyll was the ability to easily group a collection of posts as a series. This entry describes how to add that functionality.
I've created a jekyll plugin to easily import photosets from my Flickr account into posts. In this article I walk-through the code and integration.