Find page by frontmatter item

I have a blog and I have a field in my frontmatter where I define whether a post is features or not “featured: true/false”. I’m looking for a way to find the posts where featured is true and can’t seem to find any examples. Any ideas?

By having a frontmatter setting, you would have to loop over every post and check if header.featured == true.

Something like:

<h1>Featured Posts:</h1>
{% for p in page.find('/blog').children if p.header.featured == true %}
  <li><a href="{{ p.url }}">{{ p.title }}</a></li>
{% endfor %}

This is untested but should work :slight_smile: BTW this was almost exactly the same as this example in the docs.