Skip to content

Instantly share code, notes, and snippets.

@sskylar
Created April 13, 2017 19:49
Show Gist options
  • Save sskylar/968daf7dd6a876381c2d0663a1a933af to your computer and use it in GitHub Desktop.
Save sskylar/968daf7dd6a876381c2d0663a1a933af to your computer and use it in GitHub Desktop.
Loop through a particular category (or tag) with Jekyll/Siteleaf
{% for post in site.posts %}
{% if post.categories contains 'Foo' %}
<li>{{ post.title }}</li>
{% endif %}
{% endfor %}
{% assign posts = site.posts | where_exp: "post", "post.categories contains 'Foo'" %}
{% for post in posts %}
<li>{{ post.title }}</li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment