Default status to listed

Hello,

how can I set the default status of a new page or content to “listed” instead of “draft”?

I’m using Kirby 3.

Thanks

A new page is always created as a draft, there is no option to make it listed by default.

However, you could use a page.create:after or page.update:after hook to auto-publish a page.

Note that a listed page is publicly accessible.

1 Like

Thanks! I’ll do it with the hook.

Hello @texnixe, could you give details concerning that option ?

Basically like this:

'hooks' => [
        'page.create:after' => function ($page) {
            $page->publish();
        }
]

This will give you an unlisted page. You can also use $page->changeStatus() to change the status to listed, unlisted (or draft).

3 Likes

Since Kirby 4, you can set the default status of a page at page creation via the create option in your page blueprint, which also creates the page create dialog:

1 Like