Blueprint - How to query all pages that have the specified templates

Hi everyone,

On my main blueprint (site.yml), I want to show all the pages that have the specified templates (in my case : “projet-regulier” and “projet-irregulier”, wherever they are, even in subpages or sub-subpages etc.

Here is my site.yml :

Title: Rythme
tabs:
    pages:
        icon: page
        sections:
            pages:
                type: pages
                templates:
                    - irregulier
                    - regulier
                create:
                    - irregulier
                    - regulier
            souspages:
                type: pages
                templates:
                    - projet-irregulier
                    - projet-regulier

Since it doesn’t show any page in “souspage”, I understand that it is searching only among the direct children. Is it possible to search everywhere in the content ?

Thanks

A section always has a single parent (defined by the parent property), it doesn’t support queries.

An alternative would be the Pagesdisplay section (plugin), but it won’t allow you to add pages.

Thanks texnixe, I don’t need to add pages, only display. I try this immediatly.

I installed it. How would you write the query ?
site.index.filterBy(“template”, $=, “projet”) doesn’t work.

site.index.filterBy('template', 'in', ['a', 'b', 'c'])

.index refers to all the pages ?

Yes, but use with caution: https://getkirby.com/docs/reference/objects/site/index#details

Thanks, I’ll be carefull. Is there any way to use operator ? I would like to filter the index by template’s names containing the word “projet”.

Case closed.
Thanks a lot for the time you take to answer @texnixe.