Drupal 6: Creating a Blog Archive and Topics Menu in Views
Once you begin to get some age on your blog, it can be helpful to create a side menu block to help users find posts by either date or topic. The first part of this post will deal with creating a side menu block sorted by month and year. The second part will deal with creating a topics or tags menu using taxonomy. You can also use this method on other content types like press releases or news.
If you are unfamiliar with Views, it is a very flexible and powerful module that offers a great variety of choices for displaying content. Through views you can query a database for content and format the display without having to write SQL queries.
Before you start, your blog posts should be set up as a separate content type and your main blog page set up as a view. This example uses version 6. Let’s dive in…
Creating a Monthly Archive Menu
Create Page Display in View
First we will create the page display, which the menu you create later will refer to.
Open the view for your blog and create a new page display by selecting Page>Add display. For my settings, I set row style to fields, items to display to unlimited, mini for pager, and set path to blog/archives.
Now add a new argument by clicking on the plus icon, and choose Node: Created year + month. For Title, use %1. Under Action to take if argument is not present, choose Summary, sorted descending. Click on override and update. For style, choose Unformatted or List, then update. If you want the number of items for each month to appear next to the month, choose Display record count with link. I left mine unchecked. Click on update.
For Fields, choose the same fields and settings that appear on your main page view.
Under Filters, choose Node: Published, and Node: Type=Blog Entry.
The figure below shows my settings:

Settings for Archive Page Display
Create Block Display in View
Now we will create the menu. Add a new block display by selecting Block>Add display. For my settings, I set row style to Node, items to display to unlimited, and no for pager and more link. For link display choose the archive page.
Arguments and Filters should remain the same as your page display. If you want to have a drop down menu, you can choose jump menu instead of unformatted or list.
There should be no fields.
Save the view!
Adjust Block Configuration

Archive Menu
Adjust the block configuration from the blocks administration page (admin/build/block).
Find the block you just created and click on configure. Under Visibility settings, set it to display only on the blog pages (mine is blog and blog/*), and save.
Now set the block to the region you would like it to display on the page, and save. I have mine set for first sidebar.
Putting it all together
Now when you go to your blog pages, a block menu should appear. Clicking on a date should bring up a page with all posts for that particular month, in the same format as your main blog page.
To fine tune your breadcrumbs use the custom breadcrumbs module.
With minimal styling, my menu looks like the figure to the right.
Creating a Topics Menu
In this part, I will show you how to create a topics menu sorted using taxonomy. Before you start, your main blog page should already be set up as a view and you have built up a good amount of terms or tags for your blog. I have a taxonomy vocabulary set up titled ‘Blog Tags’ that is tied to the ‘Blog Entry’ content type.
Set up URL aliases for Taxonomy
Install and enable the modules token and pathauto if you haven’t already.
Set up your URL aliases with the pathauto module. This will give all the taxonomy terms for your blog a similar path. Under the tab for ‘automated alias settings’ (admin/build/path/pathauto), select taxonomy term paths. Set the path pattern for your blog to blog/topics/[catpath-raw]. If you already have paths set up for your taxaonomy, you might want to recreate them by deleting them first through the delete aliases tab, and then selecting ‘Bulk generate aliases for terms that are not aliased’.
Create Page Display in View

Topics Menu
The following steps are similar to the ones used for the archive menu, except you will be using a different view. First, enable the built in view titled taxonomy_term from the main views page (admin/build/views), then click on edit.
Next create the page display, which the menu you create later will refer to.
Create a new page display by selecting Page>Add display. For my settings, I set row style to fields, items to display to 15, mini for pager, and set path to blog/topics.
Arguments are already set up.
For Fields, choose the same fields and settings that appear on your main blog view.
Under Filters, choose Node: Published, and Node: Type=Blog Entry.
Create Block Display in View
Now we create the menu. Add a new block display by selecting Block>Add display. For my settings, I set row style to Node, items to display to unlimited, and no for pager and more link. For link display choose the topics page.
Arguments and Filters should remain the same as your page display. If you want to have a drop down menu, you can choose jump menu instead of unformatted or list.
There should be no fields.
Save the view!
Adjust Block Configuration
Adjust the block configuration from the blocks administration page (admin/build/block).
Find the block you just created and click on configure. Under Visibility settings, set it to display only on the blog pages (mine is blog and blog/*), and save.
Now set the block to the region you would like it to display on the page, and save. I have mine set for first sidebar.
Putting it all together
Now when you go to your blog pages, a block menu should appear listed by topic. Clicking on a topic should bring up a page with all posts related to that particular topic, in the same format as your main blog page.
To fine tune your breadcrumbs use the custom breadcrumbs for taxonomy module.
So there you have it. Now your users have more options for finding what they need. If you want to take it a step further, you could add another menu for most popular posts. I was able to create one from the original blog view by adding another block with items sorted by Node statistics: Total Views. Views are very flexible and the possibilities are endless!
This post was written by:
Fawn Kildoo
Associate
For more information on this post, the technologies discussed here, or our Software and Web Development services, please e-mail us at contact@zekiah.com.