Creating a Drupal based website with a blog on a page other than the front page can be frustrating and a bit confusing. By default, when Drupal is installed it has two content types, Story and Page, and lists on the front page any stories or pages you create and mark as Published and "Promoted to front page". However, many sites want their front page to be a static or semi-static Page and a blog in a different section of the site.
There's currently some debate in the Drupal community as to whether you should do this by using the Story Content Type or enable Drupal core's Blog Module which uses a Blog Content Type. For a basic site with a single blog the Blog Module can seem like overkill as it accommodates multiple blogs on a single site. However, if you elect to go without the Blog Module it can be a mystery how to display new Stories under a new blog section.
In this article, I'll show you how to set up your Drupal 6 site with a new front page and a section for a single blog. To tie everything together nicely you'll learn how to:
- Download and install the required modules
- Create a new blog section
- Create a new front page
- Configure the Primary Links menu
- Tweak the breadcrumbs and menu
Download and install the required modules
You'll need the following 5 modules if you don't already have them:
- Views (download)
- Pathauto (download)
- Custom Breadcrumbs (download)
- Context (download)
- Chaos Tools (required by Context) (download)
Download the modules you don't already have (remember, you may have modules that just aren't enabled) and install them on your site. For help on how to do this visit the Installing contributed modules section on drupal.org.
Also, some module downloads actually include multiple modules. Be sure to enable the following modules:
- Views UI
- Chaos tools
- Context UI
- Custom Breadcrumbs
After these modules are installed and enabled it's time to focus on creating the new blog section.
Create a new blog section
To create a new section that looks like what people expect a blog to look like you'll need to create a new View.
First, in the Admin section of your site go to Site Building > Views > List, and Enable the view titled "frontpage". You'll then want to press the Clone link on the frontpage view and add the following information on the next screen:
View name: blog\ View description: This site's blog.\ View tag: (can be left blank)
Click Next to move on to the "Edit view blog" page. If you aren't familiar with Drupal 6 Views this page may look extremely confusing!
Let me explain a little about how this page works:
- Displays - On the left side of the page you'll see a list of different ways to display the view. In this case, Default applies to any and all display methods unless they are overridden (changed). Page is what users will see when they click to your blog section. Feed is what users will see when they access the RSS feed of your blog.
- Settings - Everything else on the edit view page is pretty much for manipulating how the view is displayed.
You'll need to make the following changes in each of the displays:
Default\ Title: Blog\ Add a filter for "Node: Type" is one of "Story"
Page\ Path: blog
Feed\ Path: feed
Afterward, click on Save and then "view Page" in the upper-right corner. It should be a blank page unless you have any Stories created, but notice the URL now has /blog appended to it.
Create a new front page
Now, you'll need to create a new Page to act as your front page. Add a new page in the Admin section at Content Management > Create Content > Page with the following information and click Save:
Title: (Your site name)\ Body: (Whatever you want to be on your front page, e.g. "Test Site")
Next, you'll have to set your page to be the front page by going to Site Configuration > Site Information and change the following and click Save:
Default Front Page: (Path to your new page, e.g. "content/test-site")
You can now go to your site's front page and see your new page is shown.
Configure the Primary Links menu
Visit Site Building > Menus, click on Primary Links, and click Add Item. The Primary Links menu can act as the main navigation for your site. If you already use a different menu for this then edit that menu accordingly. The first item should be configured as:
Path: <front>\ Menu link title: Home
Leave everything else as it is and press Save. You can then add another item with the following information:
Path: blog\ Menu link title: Blog
After pressing save you'll now have a working site with a custom front page and a blog. However, to really make your blog look and feel right you'll need to do some additional tweaking with some other modules below.
Tweak the breadcrumbs and menu
The tweaks below are using three additional modules you've already downloaded to keep your site organized so the user knows where they are on your site.
Visit Site Building > URL Aliases > Automated alias settings and make the following change in the "Node path settings" section and click Save:
Pattern for all Story paths: blog/[title-raw]
You can think of this setting as one that means all new Stories you create will be added with a path within the blog "directory". Also, at this point, you should probably create a new Story so it's assigned the right type of path and is listed in your Blog. If you already have Stories you'll want to generate new paths for them in the same Automated alias settings section above by checking "Bulk generate aliases for nodes that are not aliased".
Visit Site Building > Custom breadcrumbs and click "Add custom breadcrumb". You'll then want to add the following information and click Save:
Node type: Story\ Titles: Blog\ Paths: blog
This will add a link to your Blog section in your breadcrumb trail whenever viewing a Story.
Visit Site Building > Context > Add and make the following changes and then press Save:
Namespace: context_ui\ Attribute: section\ Name: blog\ Path: blog/*\ Active Menu: Blog
This will ensure when users click on stories in your blog it will keep the blog menu item added earlier marked active. Depending on your blog's theme this may mean the menu item is highlighted a special way or may do nothing at all.
You should now have a site with a custom front page, custom menu, and a blog section with working breadcrumbs. Yep, definitely a lot of work, but hopefully you learned something about how Drupal works along the way.