In this tutorial, we will review how to use the pre-made maintenance template of Bolt. This is a good option when you are performing major modifications to our Bolt CMS website. Your users will not be able to see those changes until you allow them to.
The process is quite simple. Since Bolt has a maintenance_default.twig pre-defined template, all that we will need to do is to make some modifications to the general configurations file. The Bolt application will display the template to our website’s visitors, while the administrative users will still have access to the website itself.
In order to set Bolt in to maintenance mode you have to add a couple lines of code in the beginning of the config.yml file. First, log into your website as administrator. Move your mouse pointed over the Configurations tab on the left-side menu and the click on Main Configuration.
This will open the config.yml file for editing. As we said Bolt has an existing predefined maintenance mode template. What we have to do is tell the controller to preview the maintenance template to the website’s visitors. Scroll down to the maintenance_mode section, which is around row 52. Change the following values
After performing the alterations to the config.yml file, simply click on the Save button to keep the changes.
In order for us to see if the changes that we’ve just made have taken effect, we’ll simply have to access our website.
Make sure that you either logout from Bolt, or open the front page with another browser, otherwise you will still be able to access the mainpage, because you are logged in with a user, for which the maintenance rules don’t apply.
What you will see is this page:
To disable the maintenance mode, simply change the maintenace_mode value back to false.