Preview of draft on one-pager site

Hello everyone,

I’m having an issue with a one pager site I built with Kirby 3. The sites sub-sections are all children of the sites home page. Now my client would like to create a new section, but preview its draft before publishing it.

I have already included <?php go('home')?> in the sections php template. In the sections blueprint options I have set the preview template to the sites home page:

  preview: "{{ page.parent.url }}"

Now, when I click on the Open Button on a Section that is still in draft mode, I can see the sites homepage in its current state, but without the section draft included. I suspect that might have to do with the sites homepage only rendering children that are listed which excludes draft. I’m also surprised that the URL opened does not include anything like _draft but is rather just the standard URL to the site.

But how can I enable a preview for sections without publishing them first?

As you rightly said, your home template only lists published pages. You could change your logic a bit with an if statement to show children()->listed() to visitors, and childrenAndDrafts() to logged-in users.