How to Make a Custom Front Page in Drupal

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.

Comments

Custom Front Page with Drupal Theming

Sorry if this is not the correct place to ask a question (there are no other posts), but...

"just create a file in your theme directory called page-front.tpl.php and add the code for your front page there"

Per recommended practices, I've created a custom theme under the path:
sites/all/themes/mythemename/

I have a customized theme here (I modified bluemarine). Wanting a different front page, I then copied an original bluemarine template into the directory and renamed it page-front.tpl.php. My drupal site still loads the customized theme (which has a file name of "page.tpl.php") What is wrong here?

Drupal front page

I'm not sure if I understand exactly what you did. Try this:

Take your theme -- e.g., bluemarine. Don't change the name of anything, but just create a new file called page-front.tpl.php. Put your HTML and PHP code for your front page in that file and Drupal should load the contents of that file as your front page.

I'm struggling with it

I'm sorry to have bothered you with this... it's still not working but I'm going to have to struggle with it for a while to see if I can get some kind of rational behavior out of it. I guess the main thing I wanted to know is:

1) is the page-front.tpl.php supposed to be in the path recommended by Drupal documentation on theme customization (it had better be), and

2) If it was REALLY supposed to work (or if there was a bug that prevented it working).

It seems I'm doing what I'm supposed to, so that's why it's going to be difficult to help me until I know more myself.

The page-front.tpl.php is

The page-front.tpl.php is supposed to go in your theme's folder—the same folder as page.tpl.php.

Here is a screenshot of the Bluemarine theme folder with a new file that I created called page-front.tpl.php:

Drupal front page customization

You just put HTML and PHP in that page-front.tpl.php file like a regular Web page. Try a sample version with just the following content:

<h1>Hello world</h1>

Let me know if that doesn't work for you. Send me an email through my contact form and I could walk you through it over Skype or messenger.

Custom Front Page with Drupal Theming

Hey! I made SOME progress with your help, I think I had a mis-named file among other rookie mistakes. At the moment, I've managed to lock myself out of the admin functions, but I can recover from that. Once I straighten that out I think I'm home free. Your "Hello World" example showed me that I was confusing my test page-front (which was the box-stock bluemarine page.tpl.php) with my custom theme because one was derived from another, so the logo and layout didn't change much between refreshes/login/logout cycles.

Thanks for the help and generous offers, I think I've got it now.

Drupal front page theming

Great... glad to hear that it's working...