Hi All, I’m trying to make some kind of maintenance mode toggle in my back end which when activated would force any viewer to see a specific maintenance.php template instead of the standard website. I have a toggle in my site.yml as well as a template and blueprint setup but i cant figure out how to force the redirect. Any help would be appreciated.
sections:
maintenance:
type: fields
fields:
maintenance:
label: Maintenance mode
type: toggle
text:
- Site live
- Maintenance
default: false
help: Show the maintenance page to visitors
Thats for this, after some testing and some help on the discord I managed to get it to work with this
if (
site()->maintenance()->toBool() &&
!kirby()->user() &&
kirby()->request()->path() !== ‘maintenance’
) {
http_response_code(503);
snippet(‘maintenance’);
exit;}
?>
But I am also using SWUP to create smooth transitions and the two seem to clash sadly