Improving where filters in Jekyll
where filter selects items from arrays so you don’t have to loop through an entire set. In Jekyll this is useful for creating things like category listings, as well as cutting down on site build times.
So you might output a list of all posts in the
web category like this:
That’s good, if a little restrictive.
where only lets you filter for conditions where something equals something else (in this case where the category equals web).
There are times when you might want to filter for all articles not in the
web category. For this, you need the
where_exp lets you use expressions and operators in filters, such as
!=, so you could also use it to filter for all posts in the
libraries categories. Here’s how you filter for everything not in the
Consider subscribing to the RSS feed. That way, you’ll get notified whenever I post anything new. If you’re not sure about RSS feeds, I wrote a guide to RSS.
General Election! 2017! Previous post
Next post The end of The Deck