Customizing The Front Page Of Your Site

Lesson Eight of my special Getting Started With Drupal series of videos.

In this tutorial I show you some simple ways of creating a more custom look on the front page of your site. All blog posts are demoted from the front page. Blocks are moved into different regions allowed by the theme. A node is created specifically for the front page. Finally, I show you how to make some basic changes to the tpl.php template file so that you can have a front page that doesn't require any nodes to be published on it.

Bookmark and Share Bookmark or Share Post

Comments

Anonymous's picture

Good work

Hi! Nice work with your tutorial.

Can you use panels to build a front page?

Thanks!

Anonymous's picture

Nice trick on hiding the Navigation to only admin/*

I am not even sure how necessary it is now that I am using that Administrator module.

KR's picture

Excellent tutorial; clears

Excellent tutorial; clears alot of misunderstanding regarding themes i had in past. as you mentioned using page-front.tpl.php and you said that you can also use it for about. what about other pages like if you create a contact page; or products page, or maybe custom views pages, is it possible to use this technique for those pages. Also if you could please briefly explain how is it that this works.

Richard's picture

Renaming of page files

Really excellent lesson now. Similar question to that of another reader. Clearly page-front is something which Drupal recognises when te file is renamed. So, this technique can only be used for a limited list of page names (you mentioned 'about').

learnbythedrop's picture

Page Template Files

That's correct. If you want to create a template for a page titled "about" you would create a template file called page-about.tpl.php.

beanluc's picture

page-*.tpl.php file names

So, my "page-WHATEVERS.tpl.php" name should match a node which TITLE is WHATEVERS? Is that about right?

"page title" could mean a lot of things here... my link could say "about" but the node that links to could be titled "About SaveTheHobbits.ORG and the dedicated fetishists who love them".

Richard was asking about "a limited list of page names". FRONT obviously is like a magic word. Why does "about" work?
Because that's also a magic word?
Or, because it's a value that matches a node's title or matches a link label or matches some other value which someone entered someplace?

Thanks,
BL

learnbythedrop's picture

About works because in the

About works because in the case of the example it matches the title of the node. Front is different because as you say it is a "magic" word in Drupal template lingo.

bootsykronos's picture

When you created a "Front

When you created a "Front Page Node" (around 5:30 into the vid) you had a character toolbar with all the font settings like font type, font size, etc... I dont have that.. Do you have to install this feature or something???

I have the latest drupal installed (in my own language).

Thanks alot for your help

Cheers

learnbythedrop's picture

FCKeditor

I believe what you are referring to is the WYSIWYG editor. In the video I'm using FCKeditor. http://drupal.org/project/fckeditor

Gbenga's picture

I Can't Access the Login Block

Greetings. Thanks so much for these vids. I had no clue about Drupal before i took them on.

Anyway, after watching this lesson, i logged out before i promoted the login block back to the home page. Now i can't login. When i try to get in via the URL of the login page of my test site, i get a "you are not authorized to access this page" message.

Any idea how i can now login to my test site when i don't see the login block on the home page?

learnbythedrop's picture

Login Page Address

If you go to your site address /user/login you will find that standard login page for Drupal.

Gbenga's picture

Thanks. I managed to figure

Thanks. I managed to figure it out after a while.

David Naian's picture

Really great Video Post

Hi, Rob. This was really usefull to me. I really appreciate this Video and your very easy explanations on how to performe change to the front-page. Thanks very much.

Anonymous's picture

Nodes versus blocks

You said that one dif betwn blocks and node is that blocks aren't searchable. So, I'm inferring from that info that if one uses VIEWS to put a node into a block on, say, bottom-content region, rather than $content, that that article will not be searchable. That begs an answer to the question: How to put a node in a region other than $content and have it be both searchable but also have all the attributes of story/page or other node types.

learnbythedrop's picture

Should Be Searchable

You stated that, "...if one uses VIEWS to put a node into a block on, say, bottom-content region, rather than $content, that that article will not be searchable."

The article will still be searchable because you initially created a node. That node, even though it is not displayed as originally created, will have it's own permanent link on your site. And nodes are indexed by Drupal's search function. The View is merely a choice for how and where to display the node content.

An example of something like that not being searchable would be if instead of creating a node, you created a block straight away and used your theme or a module like Panels to place the block. Then the content would not be searchable in your Drupal site.

Vinay's picture

Can we use panels on front page

rob great tutorial. am building a large drupal project with the help of your videos. I was wondering how can we use panels for front page? can be it similar to the setup you demonstrated?

learnbythedrop's picture

Panels And The Front Page

You could use panels to do something similar. I am not using panels. I am using a slightly modified version of the normal front page for this theme that I created via a file named page-front.tpl.php. You could create a page using panels and then set that to be the front page. See http://learnbythedrop.com/drop/131 for more info on my method.

Vinay's picture

thanks

rob, i already saw the video. I was just wondering if we could build the same thing with panels and as you said we can.

i am actually starting out a new project next week and would need to customise front page, so your tutorials are really helpful. I might ask you a few questions if i am stuck somewhere. Hope you dont mind. Thanks again

Nick's picture

Thanks

I currently have a site that works but it is so difficult to update change

Drupal looks right up my street

Thanks

Your a genuine master

dwang's picture

Thanks for the great video.

Thanks for the great video. However, it didn't work for my theme which is Pushbutton.

I followed your instruction by commenting out the 2nd line in the following code in the page-front.tpl.php. But now the content section of the front page is empty and doesn't display any block. Please help.

<?php print $feed_icons; ?>

Thanks.

learnbythedrop's picture

Editing Front Page

If your edit of the theme doesn't produce the desired results you should restore the previous version and double check that you removed the correct section. Focus on the code rather than the line it's on since different themes may have some different page code in them.

Rodger's picture

Need just a block onthe Front Page

I have a story Front Page and I want to include a slideshow of images I have in sites/files/images to the right side of the welcome text. Something like a two column view. I have downloaded views and views_slideshow. Am I going in the right direction here as I am not sure how to configure these three elements together?

learnbythedrop's picture

Slideshow Block

You would want to install CCK, FileField, ImageField, ImageAPI and ImageCache modules so that you can create a content type as I do in the following link. http://learnbythedrop.com/drop/148

Then you would need to install Views and Views Slideshow which you could use to create a block that displays the images you uploaded using the new image (or photo) content type that you created.

Jochen's picture

I think why dwang is having

I think why dwang is having problems is because you forgot to delete the closing div tag when you deleted the content from the code, see in the video at 16:25

Great tutorial though.

cheers

V's picture

drupal lesson 8 trial

I was trying to do administer-blocks to clear the blocks on my test site
Then I got a message.
Use of undefined constant E_DEPRECATED - assumed 'E_DEPRECATED'

What should I do?
V

Dave's picture

page-example.tpl.php

Hi Rob, and thanks for the videos - all great.

I successfully edited the front page so the output is different from the other pages.

Unfortunately I am struggling to modify other pages using page specific templates. I created a modified template, say page-example.tpl.php, but the example page is created using the default page template. The node title is content/example.

Are there any reasons why adding a page specific template would not work?

thanks again

Dave's picture

page-example.tpl.php

Just realised that I needed to specify the original node name, rather than the pathauto alias!

Is there a quick way to establish the original node name?

learnbythedrop's picture

Page Template Names

The name of the template file should be the same as the "Title" of the node. So if you create an About page with the title "About" then the template file should be page-about.tpl.php.

Anonymous's picture

Left sidebar on the front page not seen

Hi Rob. Thanks for the tutorials. I had first deleted the line <?php print $content ?> and saved it. Then when you mentioned that it need not be deleted, I undid my action (ctrl z). Then I commented out this line as well as <?php print $feed_icons ?> by adding <:-- at the begining and --> in the end. I saved it. When I refreshed my front page, the left sidebar is not seen although in the admin>site building>blocks page my settings are intact. I am using the garland theme. I deleted the commenting out syntax and still my page is not restored on refreshing. Could you please help.

learnbythedrop's picture

Restoring Front Page

When it doubt, delete the Garland folder and re-upload the folder for Garland from your local hard drive. That will restore Garland to its original state. What would be better is to save a clean copy of your page.tpl.php before making edits.

scott's picture

rss icon

After you create page-front.tpl.php and refresh your homepage i notice your rss icon is under your blocks on the left. My rss icon moved up the page, and appears to still be in the section that was content. Then, after i moved some of the blocks to the preface, as you do in the video, the rss icon is centered, more or less, at the bottom of the preface.
everything on my test site looked exactly like yours in the video until the page-front.tpl.php change. any idea why my rss icon seems to go where ever it feels like?
thanks,
scott

learnbythedrop's picture

Location of RSS Icon

It's hard to know why. Are you using the same theme that I am?

Anonymous's picture

i am using the same theme. as

i am using the same theme. as i think i mentioned in my original post i followed all your steps in the videos leading up to this issue, and everything worked great. except this.

nezar's picture

Customizing The Front Page Of Your Site

U r the one who must go to the heaven ,, tnx sooooooooo much :)

eefo's picture

Re: Customizing The Front Page Of Your Site

i would love to thank you again for this lesson but found some thing strange ..
while editing the page-front.tpl.php , found it different than yours :$

http://api.drupal.org/api/drupal/modules--system--page.tpl.php/6/source

this is what showing in my page .
now can you tell me what to delete from this ? :$

learnbythedrop's picture

Re: Customizing The Front Page Of Your Site

There is now a much better way to create a nice custom front page. See my tutorial on the Panels module. http://learnbythedrop.com/drop/164