Blueprint with variable query

So I have a portfolio page with three subpages and a project page that has n subpages. Each project consists of images, and every image can be assigned to a category from the portfolio:

portfolio
   cat 1
   cat 2
   cat 3
project
   project 1
      image 1 (tagged with cat 1)
      image 2 (tagged with cat 1, cat 2)
      image 3 (tagged with cat 1, cat 3)
   project 2
      ...

Idea behind this structure is: A project is created, but might consist of images from different categories. Images will only have to be maintained in the project section and will then automatically populate the portfolio correctly.

A portfolio category consists of a main image, a category plus the images tagged accordingly in the project section. Here is the blueprint:

title: Portfolio Category

columns:
    main:
        width: 2/3
        sections:
            section_1:
                type: fields
                fields: 
                    beschreibung:
                        type: textarea
                    mainimage:
                        label: Hauptbild {{ page.uri }}
                        type: files
                        max: 1
                        min: 1
                        # query: site.find('projekte').children.images.filterBy('category', 'portfolio/people-at-work', ',')
                        query: site.find('projekte').children.images.filterBy('category', '{{ page.uri }}', ',')
                        cover: true

For the mainimage only the images from the project from the projects should appear. I have two queries. The uncommented one does work, I have hardcoded the category that should appear. But this is dynamic! But that doesn’t seem to work. Is that possible at all?

Have you tried using “page.uri” without the curly brackets?
I had a pretty similar query where I first used the curly brackets and it didn’t work. Without them it works.

So like this:

query: site.find('projekte').children.images.filterBy('category', page.uri, ',')

For reference, this is my use case. “event_location” is a field on the same page:

query:
    fetch: site.find(page.event_location).location_venues.toStructure

thanks a lot. I was pretty close :wink: