aPaddedCell Article: Creating a Custom Home Page in Drupal Using Views

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Here's the article summary:

aPaddedCell wrote: One of the most popular questions people new to Drupal ask is: ‘How do I change the home page?’ By default the index page of a Drupal site has a bloggy feel, the latest items shown in date order, but it doesn't have to look like that! That is the aim of this article, to show two ways—because there is always more than one way to do something in Drupal—to customize a Drupal home page.

Post any comments, suggestions, questions etc. here. Hope you find the article useful. Smiling

a Padded Cell our articles site!

They have: 27 posts

Joined: Mar 2007

Nice article. I found out about it here. Very through and easy to follow.

I didn't know there were any Drupal fans around here!

I'm contributing my first theme in the next week or so. Maybe I should post it up here for some feedback Smiling

They have: 27 posts

Joined: Mar 2007

BTW, I recently created a group on Facebook called Drupal Theme, so I posted it up there for the members. Smiling

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

jGirlyGirl wrote: BTW, I recently created a group on Facebook called Drupal Theme, so I posted it up there for the members.

Wow, I haven't got a Facebook account so can't go and see, but thanks for posting the link up there. Smiling

Glad you liked the article.

a Padded Cell our articles site!

He has: 2 posts

Joined: Nov 2007

You certainly have good articles about drupal. Thanks for your contribution to the community and development of drupal.
Ohya, drupal won! Yipee
http://www.packtpub.com/award

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Indeed, Drupal did win the award. The head honcho of Joomla! congratulated the project in the comments on the news item on drupal.org: thought that was very sporting of him. Smiling

Go Drupal! Laughing out loud

a Padded Cell our articles site!

They have: 1 posts

Joined: Nov 2007

I was folowing the directions in the Creating a Custom Home Page in Drupal Using Views. When I got to filter part.

Next Filters are used to ensure the view includes only articles published and promoted to the front page by an administrator. Expand the Filters group by clicking on it.
It has no filters. Am I supose to install these? Thanks for the info.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

whirlwind4God wrote: It has no filters. Am I supose to install these? Thanks for the info.

Hi, welcome to TWF! :wave:

You should add the filters yourself, yes. Filters allow you to filter the data in a view. In this case, we only want to see articles that have been published. We do this by selecting a field from the drop-down, then clicking add. That will give you options on how to filter the field.

Does this make sense? Smiling

a Padded Cell our articles site!

They have: 2 posts

Joined: Jan 2008

Hi. Thanks for this article. I implemented the 'simple' suggestion and though it appears to work OK I have two problems.

1) The title of the 'article' that now is the home page content links to node/2 (the internal drupal url of this page)

2) There is a 'Read More' link at the bottom that also links to node/2

This is obviously bad as it will cause duplicate content issues with the home page content, plus it just plain looks bad.

Anyone seen and solved this?

They have: 2 posts

Joined: Jan 2008

Found a solution. Added some magic to node.tpl.php

Edited the area where the is produced to look like:

<?php
if ($page == 0):
?>

<?php
if ('home' == $node->type){ 
        print
$title;
} else {
        print
"<a href=\"$node_url\" title=\"$title\">$title</a>";
}
?>

<?php
endif;
?>

Then edited the class="links" area to look like:

<?php
if ('home' != $node->type ) {
?>

<?php
if ($links):
?>

<?php
print $links;
?>

<?php
endif;
?>

<?php
}
?>

They have: 1 posts

Joined: Jan 2012

I have been using Front page module and notice that once the page is edited any code outside the body tag is removed so no , this makes the page break in IE and will not vaildate with W3C. Any thoughts on a missing setting somewhere within Drupal?

They have: 1 posts

Joined: Mar 2008

I did everything the article stated and I cannot get the field group or the filter group or the sort group to let me add anything. Everything is enabled as far as I know.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Hi jrockford. Is this a problem with Views that you're experiencing? If you haven't worked out a way around it you might need to raise a Support Request. Also have a look through the existing ones, see if anyone else is seeing the same problem.

Sorry I can't offer more help. Sad

a Padded Cell our articles site!

They have: 1 posts

Joined: Apr 2008

Hi, great article but are you planning on updating this for Drupal 6?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Most of the same instructions apply for DP 6 - views is set up very differently though. In 6 views comes with a recent posts view so you don't have to create one yourself. You can also adjust the default view so it leaves out the first 3 posts that you have already displayed.

They have: 1 posts

Joined: Apr 2008

Been looking for this all over drupal site but no luck till I found my way here. Thanks alot

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Am not going to update this for Drupal six until Views is properly released, and when I have some free time of course. Smiling

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Yes, Views is an awesome tool for creating customized "views" of Drupal content.

I am using the Video module, with the "recent videos" (tracker) view as the site's front page.

Another request I get frequently is to remove all the menus and breadcrumbs and stuff to make certain pages look like plain vanilla html pages.

So I stripped the barebones Framework theme even more to create a blank theme

The admin is still enabled, and could also be set with Admin Theme.

I attached a screenshot, with only the Devel switch user showing in the footer (in lieu of a login form during development... yes, you could still go to the /user page, but this is fine for now) The Flash is imported from client's web site in a node with an iframe...

It's not completely stripped, but goes quite a way. I proposed including it in the Framework distro, the Framework maintainer sees no need for it.

Should I develop it as a separate project?

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Should I develop it as a separate project?

If there isn't something already like that out there then, yes. There is value in having a completely blank theme, particularly if you make it easy (by providing .tpl.php files) to build upon it.

And even if you don't make it public, it's still a worthwhile coding exercise. Smiling

a Padded Cell our articles site!

mittalpatel's picture

He has: 1 posts

Joined: Sep 2009

Thorough and nicely written article. Very helpful to the newbies of Drupal.
Anyways, sometimes I use page-front.tpl.php or Advanced front page module (http://drupal.org/project/front). They are also very useful to get your homepage customized according to your (or your client's!) needs.

Thanks for the valuable article.
- Mittal Patel
http://www.MittalPatel.co.in

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.