Finding Pages with a certain value

I’m probably being really thick here, but I am quite new to Grav. I’m use to ProcessWire, so coming to this amazing framework is a little confusing at times lol.

I’m trying to find child pages that contain a certain field value…for example there is a field called No. Bedrooms, and I want to find all the pages with No. Bedrooms = 3

I’ve searched and searched the documentation and on the forums - just can’t seem to figure it out. Would someone please enlighten my confused mind :slight_smile:


Assuming each of your children page have a fields header.bedroomnumber you could go with something like

{% for house in page.children if house.header.bedroomnumber == 3 %}
{{ house.title }}
{% endfor %}

Grav’s find() function relies on path, although you can use taxonomies to find a collection of pages that are related, and then filter manually.

So the best approach I think is to use taxonomy to limit the potential pages you are going to search, then just loop over the results and pull out the ones with a certain page.header.bedroomnumber.

Thanks guys, I’ll give this a try!