Blueprint: How to display images of a subfolder of the page?

Hi

In /content/1_project/gallery there are images stored of the project page.

In the project.yml I tried this to display those gallery images like this:

title: Default Page
sections:
  info:
    type: fields
    fields:
        introtext:
          label: Introtext
          type: textarea
          size: middle
        maintext:
          label: Maintext
          type: textarea
          size: middle
  gallery:
    type: files
    layout: cards
    query: page.children.find("gallery").files

But the gallery section is empty.
What did I missunderstand? :slight_smile:

Alain

gallery is a files section and a files section has a parent property but no query property, so your section should look like this:

  gallery:
    type: files
    layout: cards
    parent: page.children.find("gallery")
1 Like

Thanks!
I do not understand the difference between query and parent, but it works :slight_smile:

The parent property (available in pages and files sections) expects a single page object. From this page object, it will fetch the files (files section) belonging to this pages or the parent’s child pages (pages section).

The query property on a pages/files field (which is similar in functionality to a select field/multiselect field, but more specialized), however, expects a collections of some sort. The queried collection is not limited to a single parent page.

1 Like