How to Make a Custom Front Page in Drupal

Tags:

There are several ways to set a custom front page in Drupal. Four of them are described here.

Custom Front Page with a Node

In Drupal 5 you can set a custom front page on your Site Information page found at http://example.com/admin/settings/site-information. At the bottom of that page you will see the following option:

Setting a custom front page on Drupal's Site Information Page.

To make a custom front page, just create a new node and then enter the path to that new node in the "Default front page" settings.

For example, if you build a front page on a node at http://example.com/new-front-page, then just enter new-front-page into the "Default front page" settings.

The main SEO issue to be aware of when doing this is that it creates a duplicate front page URL: http://example.com/new-front-page will show the same content as http://example.com/. Possible fixes for that problem are either to:

  1. Block off the duplicate URL with robots.txt, e.g., Disallow: /new-front-page$
  2. or install the Global Redirect Module which will automatically 301 redirect your front page node to the actual front page (http://example.com/).

Custom Front Page with the Front Module

For more control over your front page, for example to completely override your theme, you could install the Front Page Module. The Front Page Module allows you to set different front pages by user role, as well as include PHP snippets in the front page.

Use of the module is straightforward and is basically self-documenting. A screenshot of the Advanced Front Page Settings from the Front Module is shown below:

Drupal Front Page Module settings

If you use Drupal's Front Page Module, it will create a duplicate front page located at http://example.com/front_page. To address this issue from an SEO standpoint, add the following line to your robots.txt file:

Disallow: /front_page

Custom Front Page with the Views Module

If you have the Views Module installed, it will create a front page view located at http://example.com/frontpage. You can control the settings for that page at http://example.com/admin/build/views.

Drupal Views, custom front page

To edit the View for this type of custom front page, go to http://example.com/frontpage and click on the "Override" tab. Then create a Drupal View just as you would create any other Drupal View.

If you have the Views Module installed, be sure to block off that duplicate front page with the following robots.txt rule:

Disallow: /frontpage$

Custom Front Page with Drupal Theming

To create a custom front page in Drupal through your theme, just create a file in your theme directory called page-front.tpl.php and add the code for your front page there. Whatever you put in that file will be the front page of your Drupal site.

Average: 4 (5 votes)

Comments

An elaborating question

Thanks for the great article. Regarding the last part, "Custom Front Page with Drupal Theming", how do I assign stuff (forms, for example) to my new custom front page?

Webmaster Tips's picture

Drupal webform

See this discussion on Drupal.org about embedding webforms:
http://drupal.org/node/248157

To embed a block on a homepage, see this:
http://drupal.org/node/164799

To create a new region (block regions that can be assigned with the Drupal admin panel) see this:
Drupal 6: http://drupal.org/node/171224
Drupal 5: http://drupal.org/node/29139

Syndicate content