Include jekyll / liquid template data in a YAML variable?

Today I ran into a similar problem. As a solution I created the following simple Jekyll filter-plugin which allows to expand nested liquid-templates in (e.g. liquid-variables in the YAML front matter): module Jekyll module LiquifyFilter def liquify(input) Liquid::Template.parse(input).render(@context) end end end Liquid::Template.register_filter(Jekyll::LiquifyFilter) Filters can be added to a Jekyll site by placing them in the … Read more

How to adjust Jekyll post order?

There is an example in the official Jekyll documentation how to create a basic post archive page: Displaying an index of posts Bonus: For a prettier archive page (grouped by year or year/month), see this answer. You’re right, I can’t find anything in the docs where it says how the posts are ordered, but in … Read more

Enabling Liquid templating syntax highlight in webStorm/phpStorm

I’ve found out that Twig have a very similar syntax to Liquid, enabling the Twig plugin will highlight Liquid syntax and will keep the HTML highlight/autocomplete/emmet functionality working as opposed to the “textMate Liquid bundle”. Go to Settings > Editor > File Types find “Twig” on that list and associate Liquid files with it by … Read more

Liquid templates: even/odd items in for loop

I think you’ll want to use the cycle tag for this. For example: {% for post in site.categories.articles %} <article class=”{% cycle ‘odd’, ‘even’ %}”></article> {% endfor %} If you want different HTML markup for each cycle: {% for item in site.posts %} {% capture thecycle %}{% cycle ‘odd’, ‘even’ %}{% endcapture %} {% if … Read more

Jekyll/Liquid Templating: How to group blog posts by year?

It can be done with much, much less Liquid code than in the existing answers: {% for post in site.posts %} {% assign currentdate = post.date | date: “%Y” %} {% if currentdate != date %} <li id=”y{{currentdate}}”>{{ currentdate }}</li> {% assign date = currentdate %} {% endif %} <li><a href=”https://stackoverflow.com/questions/19086284/{{ post.url }}”>{{ post.title }}</a></li> … Read more