Skip to content

Instantly share code, notes, and snippets.

@clawfire
Created March 26, 2021 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clawfire/c4c4596ddf530a58ab6795063968db2f to your computer and use it in GitHub Desktop.
Save clawfire/c4c4596ddf530a58ab6795063968db2f to your computer and use it in GitHub Desktop.
How to exclude a category from Jekyll loop and limit the number of posts
{% for post in site.posts limit: 6 %}
{% assign count = 0 %}
{% unless post.categories contains 'talks' %}
{% assign count = count+1 %}
{% unless count<=3 %}
{% include component__post-preview.html %}
{% endunless %}
{% endunless %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment