Thibault Milan
23 supporters
How to filter out a category from Jekyll ...

How to filter out a category from Jekyll post loop

Mar 26, 2021

On my website, I'll add soon a Talk section.

Since it's a content with date, I should use a post with a category (here talks) dedicated to instead of creating a collection (which should be used for elements without publish date).
Getting the talks are easy. Just a site.category.talks will have all the elements and I can loop over them just like a site.posts collection. But how to exclude talks after that from the posts listing?

And how to limit at the same time the number of posts you'll display on the site (just like the 3 blog posts on the bottom of my homepage)?

I came up with this code then, available on gist (sorry BMC can't embed gist yet)

Enjoy this post?

Buy Thibault Milan a coffee

More from Thibault Milan