Maintenance Mode for clients?

Hi,

Is there any maintenance mode builtin or plugin for Kirby 3?
I would like non-logged in users to see the maintenance page while all logged in users will see the active website.
I need this because I want to give access to an editor to input all contents of the website. I would like him to see the result of whatever changes he is making.

Thank you.

If it’s just to change content (not updating Kirby etc.), you can create a maintenance page with the content of your choice and a maintenance field in site.yml.

The redirect non logged in users to this maintenance page if the maintenance field is ticked. You can do this either in the header or use a catch-all route.

See also: Maintenance Mode in Kirby?

Thanks. I will start on that.

But how will the website know that I am logged in in the panel? With WordPress, a bar will show up in your website if you are logged in.

Kirby obviously has no bar but you could add a bar if you wanted, based on the same mechanism, checking if a user is logged in, in the same way you would do it if you had content you only want to show to logged in users.

if (! $kirby->user() ) {
  // go away
} 

Combining all, is this how to do it?

<?php if (!$kirby->user() && $site->maintenance()->isTrue() && $page->uid() != 'maintenance') {
  go('maintenance');
} ?>

Edit:
This works as long as you log in first before opening the website.

Well, yes. What behavior do you expect?

Well, yes. What behavior do you expect?

I just anticipated my users. Even if I’ll explain the proper way, I’m pretty sure I’ll be expecting calls about this. :grinning:

Is it the same with WordPress though? Haven’t touched WP for years now.

Btw, thank you for the support.

I don’t (want to) know.

1 Like