Blueprint field "pages" - Allow drafts to be selected

Is there a way to extend the pages field in the blueprints to where I would be able to also select pages that have the status “draft”? Currently it is only possible to select pages of that have been set as public and unlisted.

In a pages field, you can use a query, e.g.

sections:
  fields:
    type: fields
    fields:
      pages:
        type: pages
        query: site.find('notes').childrenAndDrafts

This would get all children + drafts of the notes page.

2 Likes

Thanks.
Where can I find more information how to write those querys for future implementations?

Hm, examples are scattered throughout the documentation. Basically, you can use most methods that you can also use in Kirby template/controllers and that make sense, including custom methods, apart from those that require more complicated parameters like arrays. Listing all possible queries would be a bit too much…

So you can do things like:

query: page.images.template('sometemplate')

But not

query: page.images.filterBy('template', 'in', ['template-a', 'template-b])

However, we will be able to do queries like the latter in Kirby 3.2.

1 Like

So if I understand this correctly i would be able to write a query that fetches all subpages that have a spezific selected radio option?

Something like (pseudo query):
query: page.children.radiofield(‘building’)

Yes, you can even do things like this:

query: site.find('notes').children.filterBy("tags", "ocean", ",")

It is recommended to use double quotes for this to work. I think we will even required it for 3.2.

1 Like

Alright thanks for you help!