Filtering

The PieCrust filtering syntax can be used to select items returned by an iterator object – including pagination items and assets.

Filters are named, and using one on an iterator object just requires to pass that name:

{% for page in site.pages.filter('my_filter') %}
...
{% endfor %}

The named filter should be available in the page’s configuration header. For instance, the following filter matches pages that have the pastry tag (i.e. a tags metadata value that contains pastry) and are not drafts (i.e. don’t have a draft metadata value set to true):

---
title: Something
my_filter:
    has_tags: pastry
    not:
        is_draft: true
---

See the templating data reference page for a full list of the available filter clauses.