Query child pages from another parent

Sorry if this question has been asked before, I couldn’t find a similar thread.

I am migrating a website from Kirby 2 to 3 and on the current website there is a blog with articles and a bunch of projects. Each blog article has the option of being associated with a project. To do this, I had set up a query in the blueprint, like this:

Project:
  label: Project
  type:  select
  options: query
  query:
    page: projecten
    fetch: children
    value: '{{uid}}'
    text: '{{title}}'

The blog articles are child pages of the home page, while the projects are child pages of a page called projecten.

The new blueprint is this (leaving out a few things for brevity), article.yml:

title: Article
num: '{{ page.date.toDate("YmdHi") }}'
icon: 📰

columns:
  main:
    width: 2/3
    fields:
      text:
        type: textarea
        size: large

  sidebar:
    width: 1/3
    sections:
      meta:
        type: fields
        fields:
          project:
            label: Project
            type: select
            options: query
            query:
              fetch: site.projecten.children.published
              value: '{{page.uri}}'
              text: '{{page.title}}'

Right now, in the panel, I get an error, saying “Invalid query result data”. How do I write the query so that it works in Kirby 3?

fetch: kirby.page('projecten').children.published

This will also find the page if it is in draft state.

Also possible:

fetch: site.find('projecten').children.published

This will only find published pages.

In cases like this, always make sure that changing the page slug is disabled. Otherwise, if the user renames the page, this will stop working.

Thanks so much once again for the quick reply! This fixed the issue.

See my added note (which is generally true for all pages that you fetch by their slug anywhere).