Show specific children of page

I have two different kinds of pages that can be added through the home page:
event and feature
is it possible to filter the children of the home page only for ‘event’ children?

for example: this is the home page yml:

 title: Home

sections:
  events:
    type: pages
    template: event
  features:
    type: pages
    template: feature

I must use this? or there’s an easier way?

Thanks!

You mean in the frontend? Then filterBy would be more practical.

$pages->filterBy('template','event');

Lot of examples: $pages->filterBy() | Kirby CMS

1 Like

great thanks - i’ll try this way - I hope it’s enough

Instead of filterBy('template') you can use the shorter $page->children()->template('event').

1 Like