Drupal front page FAQ: How can I customize my Drupal front page?
In a previous blog entry I described how to make a Drupal node the front page of your wesbite. This is very often a nice, simple approach, but if the theme or format of your Drupal front page is significantly different than your interior pages, you may have to do something more than the simple approach I described in that earlier entry.
So, in this blog post I'll cover a couple of other ways to change the front page of your Drupal website.
Drupal custom front page - Option 1: Use blocks on just the front page
The first option is to use the approach I described in my earlier blog entry, and then add blocks to the Page that is now your front page. To add blocks to only your front page, all you have to do is go into your theme editor, and define the blocks that you want to appear on the front page.
To do this, just select a block, such as the User Login block, and place it where you want in your theme. Save that location, then go in and edit the block, and in the very last entry for the block, where you define which pages this block should appear on, use the custom tag "<front>" to indicate that you want this block only to appear on the front page of your website.
Drupal custom front page - Option 2: A completely custom front page
Now, if you really want the front page of your web site to look completely different than the rest of your site, another approach is more drastic, but very powerful, and also not too hard once you get the hang of it. This approach involves modifying your theme to create a special layout for your front page.
While this sounds hard, at a high-level, this is all you have to do:
- Within your theme, copy the file named
page.tpl.php
topage-front.tpl.php
. - Note that the name
page-front.tpl.php
conforms to Drupal's naming standards, so Drupal will realize you want this to be the theme page for your front page. - Modify
page-front.tpl.php
to make your front page look the way you want it to. This page is really just a combination of HTML, CSS, PHP, and possibly JavaScript, so if you're comfortable working with these tools, this page can easily be modified.
Describing how to make changes to this file is beyond the scope of this article, but here's the important point to remember: You can change this file however you want, and it will only affect the front page of your website. All your other Drupal page's will be unaffected by these changes -- so have at it. Be as creative as you want. Shoot, you can even delete all the content in that page and replace it with straight HTML if you want.
Drupal version information
I hope this "Drupal front page" tip has been helpful. Please note that this article relates to Drupal version 6.x. Other Drupal versions may require different approaches to this problem.