Default pages field value to the page parent

Hello there!

I’m currently working on the backend of a project but I am unfortunately getting stuck. Basically, here is how the arborescence of the pages looks like:

- Main collaboration page (parent-template)
  - Collaborator (collaborator-template)
    - Projects from the collaborator (project-template)
    - …
  - Collaborator (collaborator-template)
    - Projects from the collaborator (project-template)
  - …

Because all the individual projects will be listed in the Main collaboration page, I want to default de value of a pages field in the project-template to its parent page (the collaborator) for better ease of use.

The task seems very simple and I know that the default field should output parent: - page//(page UUID), but I cannot find any documentation on how to set up the default value in the project-template blueprint. Here are all uneducated guess I’ve tried so far:


parent_field:
  type: pages
  default: " {{ page.parent }} "
  default: " {{ page.parent.uuid }} "
  default: " {{ page(page.parent.uuid) }} "
  default: " - page//{{ page.parent.uuid) }} "
  default: page.parent
  default: page.parent.uuid
  default: page(page.parent.uuid)
  default: |
    " {{ page.parent }} "
  default: |
    " {{ page.parent.uuid }} "
  default: |
    " {{ page(page.parent.uuid) }} "
  default: |
    " - page//{{ page.parent.uuid) }} "
  default: |
    page.parent
  default: |
    page.parent.uuid
  default: |
    page(page.parent.uuid)

As you can tell from my progressively random guesses, I’m lost. Is this even doable in Kirby?

Thank you in advance for you help <3

In most fields (and the pages field is probably no exception), queries don’t work for the default property. But what I don’t understand is why you need this field in the first place, given that the parent is already known by the structure of the page in the tree?

Ok that’s a pity : )
I understand why the default property wouldn’t support queries, since in most cases, it wouldn’t be used. Do you think such feature would make sense to implement in Kirby?

The field would be necessary for the navigation: when going through the projects listed in the parent-template, the client could instantly see from which collaborator it is and would be able to easily navigate to it and access the collaborator’s contact informations. The collaborator page would also show all its projects.

I’ve given the situation some thoughts and realised that the collaborators and their projects would be created programmatically anyway. I imagine it will be much simpler to just populate that parent field in PHP.

Thank you for the info <3