- Home
- Blogs
- George Boobyer's blog
- Customising your Drupal maintenance page
Customising your Drupal maintenance page
So you have created your Drupal site,configured to be as search engine friendly as you can, added loads of good content and all is well - traffic is building up and you are getting great feedback from regular visitors. Then some updates to your modules are available and you need to put the site into maintenance mode whilst you upgrade these - and that is when you find that the maintenance Site Offline page is in the classic minelli theme and that isn't what you want at all. In this post I will show you how to theme your maintenance pages in under 5 minutes with 3 simple steps.
Good lesson - one of the first stages to getting a site up and live should be to 'theme' your offline pages and any other pages that you may not routinely display. Fortunately it is a quick one to solve.
Step One
Locate the settings.php file (do your self another favour and back it up while you are at it) and make it writeable (0644).
Locate line 184 (or there abouts - you may have added extra lines already)
# $conf = array(
# 'site_name' => 'My Drupal site',
# 'theme_default' => 'minnelli',
# 'anonymous' => 'Visitor',
and uncomment the first line:
$conf = array(
# 'site_name' => 'My Drupal site',
# 'theme_default' => 'minnelli',
# 'anonymous' => 'Visitor',
then locate and edit line 196
# 'maintenance_theme' => 'minnelli',
to
'maintenance_theme' => '{your theme}',
(make sure you use the name of the theme as it is {yourtheme}.info not as it may be displayed in the admin pages) so if you are using nitobe: 'maintenance_theme' => 'nitobe',
then uncomment line 225
# );
so without all the default comments you can simple put in the following at line 226 (
224 # 'reverse_proxy_addresses' => array('a.b.c.d', ...),
225 # );
226 $conf = array('maintenance_theme' => 'nitobe' );
227 /**
228 * String overrides:
Upload the settings.php and set it back to read only (0444)
Step two
The next step is to copy your theme's page.tpl.php to maintenance-page.tpl.php and maintenance-page-offline.tpl.php and that is it for stage one - you have a themed offline page.
Step Three
The next stage is to add a couple of lines to your maintenance-page-offline.tpl.php page so that you can display a friendly message if the database is unavailable.
<?php if (!$db_is_active) {$content = 'We are currently investigating an issue with the database. Please try again soon' ;}?>
And we are done!
Once you have a functioning off-line page you can edit the maintenance page template and style it to your heart's content.
Contact Details
Blue-Bag Ltd
- info [at] blue-bag.com
- Telephone: 0843 2894522
- Blue-Bag HQ:
The Garage, Manor Farm
Chilcompton, Radstock
Somerset, BA3 4HP, United Kingdom - Telephone: (+44) 01761 411542
- Blue-Bag Brighton:
Unit 35 Level 6 North, New England House
New England Street, Brighton
BN1 4GH United Kingdom - Telephone: (+44) 07944 938204
- VAT GB 748125034
- UK Company Reg: 3932829