'draft' page title not accessible in pages method?

I use a custom pages method to extract the titles of all pages in a pages field, to show them as info in a pages section.

The pages field include childrenAndDrafts, like this:

    label: Curator(s)
    type: pages
    query: kirby.page("curators").childrenAndDrafts

I’ve noticed that ‘draft’ pages titles do not show. I am a bit confused about this.

This is the custom method:

Kirby::plugin('jaume/pagesMethods', [
	'pagesMethods' => [
		'eachTitle' => function () {
			$titles = '';
			if ($this->isNotEmpty()) {
				forEach($this as $page) {
					$titles .= $page->title();
					if ($page->isLast($this)) {
						$titles .= ' | ';
					} else {
						$titles .= ', ';
			return $titles;

And I call it in the blueprint like this:

    type: pages
    template: show
    parent: kirby.page("shows")          
    info: '{{page.curator.toPages.eachTitle}}'
    image: page.selectedimages.toFiles.first
    status: all

Can someone explain if my code is doing something I haven’t noticed or if the visibility system affects fetching info in this manner too?

Thank you

The toPages() field method only returns published (listed and unlisted) pages, not drafts.

To get drafts into your collection as well, you need a custom field method, e.g. toPagesAndDrafts().

1 Like