How to Create Custom Drupal Maintenance Page
In Drupal content management system, the maintenance page is used when the site goes off-line or the site is inaccessible due to technical problems, such as a database failure. You can also manually enable this mode from “Administer > Site configuration > Site maintenance” (In Drupal 8, Go to “Configuration > Maintenance Mode”).
However most of the clients don’t like the default maintenance page and might want to show visitors some eye-catching page by adding some elements such as images, contact info, social links etc. In Drupal there are various methods to get this done. Please look at them one by one and choose the one that best suits your needs.
There are couple of methods available in Drupal to create/theme your maintenance or offline-mode page.
If you’re new to Drupal and looking to create a maintenance page without any coding knowledge, there are few modules available in Drupal community that does the same. Some of those modules are:-
To create “coming soon” page in few minutes using coming soon drupal module, you can refer this – custom drupal maintenance page. To use “site under construction” drupal module, you will need to find some custom templates where as “coming soon” module has some built-in template, you just need to add custom heading, background, copyright text etc.
(Recommended: Drupal 8 Explained: Your Step-by-Step Guide to Drupal 8)
If you’re not ready to use another module and willing to do some tweaks in the file system, you can go for this method.
In Drupal 8, you can see the following line in settings.php :-
# $settings['maintenance_theme'] = 'bartik';
1) Please uncomment this line and change ‘bartik’ to your custom theme name. Now it will look for maintenance page template in your custom theme folder.
2) Copy the core maintenance template core/modules/system/templates/maintenance-page.html.twig to templates/maintenance-page.html.twig in your custom theme directory. You can make whatever changes needed in your custom template. That’s it!
3) Clear drupal cache and you should be able to see your custom maintenance page when site goes offline or inaccessible due to any technical issues.
You can accomplish the same in Drupal 7 using following steps:-
1) Please uncomment the following line and change ‘bartik’ to your custom theme name.
# $conf['maintenance_theme'] = 'bartik';
2) Copy the core maintenance template modules/system/maintenance-page.tpl.php to templates/maintenance-page.tpl.php in your custom theme directory.
You’re done. Please make sure to flush drupal cache to reflect the changes.
Hope you found this helpful, please comment your feedback/questions in the comment section below.