Filter pages without images/files in panel

hi there,

is it possible to fetch only pages without images/files in panel?

Since the user should upload an image for each item/page I though I could provide a list with pages without images/files. The pagesdisplay plugin makes that possible theoretically but the query is not right yet - filterBy has no file or filename is not “” is not working. Any idea?

  without_image:
    headline: ohne Bild
    type: pagesdisplay
    query: site.index.filterBy('template', '==', 'child').filterBy('filename', '!=', '')

I’d suggest using a custom collection filter for this: Collection filters | Kirby

1 Like

This should work

site.index.filterBy('template', '==', 'child').filterBy('hasFiles', false)

Or hasImages if you only want to filter those without images.

Perfect, that’s what I was looking for :+1:t2: