Querying images inside subpage

I have the next structure for my site:

  • Page
    • Subpage
      • Sub-subpage
      • Sub-subpage
      • Sub-subpage
    • Subpage
      • Sub-subpage
      • Sub-subpage
      • Sub-subpage
    • Subpage
      • Sub-subpage
      • Sub-subpage
      • Sub-subpage

I’m trying to create a field in the parent page (Page) that shows all the files used across every sub-subpage. Something like a general assets section.

How should the ‘query’ for this be?
I’ve tried page.children.images and page.children.find('subsubpage').images without success


Only subpages: page.grandchildren.images
Complete tree: page.index.images

Note that a files field doesn’t show all images, but lets you select from these images.

Thanks! Would it be possible to show all images if using a section instead?
I’m trying to show all the images used on the subpages but can’t seem to make it work like this.

This is placed in the site.yml

          files: true
          type: files
          layout: cards
          size: tiny
          sortable: false
          empty: No assets yet
          query: site.index.images

A files section can only have a parent page, so a query won’t have any effect.

If you just want to display those files without adding them, then you can try @texnixe’s filesdisplay section plugin:

Thanks. This gets closer. But I would actually need to upload files.
My idea is to have a place where the user can add all the files at once. And then use them across the pages.

Well, if files belong to different subpages, then Kirby wouldn’t know where to add them

Maybe it would make more sense if you use the parent pages to upload the files into one place, and then use a files field to select files from this “central files repo”?

Thanks for the assist on that.
That’s actually what I want to do – and managed to do.
But the issue comes with the client populating all the subpages already with images; and being in need of showing all the the images they used i the “central files repo”. Now they are ‘lost’ and not appearing anywhere.