Using views and taxonomy redirect to implement blog directory navigation
We already created a Sources vocabulary to categorize the blog directory. Now let's set up a nice browsing experience so the users can easily navigate around the blogs listed in this blog directory. The task here is to override how the user browses the Sources vocabulary, because the default format for vocabularies is not suitable for the Sources vocabulary.
We're going to do two things:-
- A nice table (view) listing the blogs/podcasts for given Sources vocabulary terms
- Making sure that browsing the Sources vocabulary uses this nice table (via taxonomy redirect)
Create a 'feeds' view
So far I've set this up as a table but of course it's up to you how this is displayed. The result will be a path "feeds/#" where '#' is a term ID and that any display of terms from the Sources vocabulary uses that path.
Create a new View, give it the name 'feeds'.
|Filters||Node published: yes, Node type: Feed|
|Fields||Node title, Node body, Taxonomy: all terms|
|Arguments||Taxonomy term ID, making sure to select the Sources vocabulary and display all items if no argument present|
Add a page display and set its' path to "feeds".
After doing this the url "example.com/feeds" will display all the Sources and the url "example.com/feeds/#" will display the sources just for the term ID. However the normal taxonomy pages for the Sources vocabulary doesn't (yet) use this view.
Use taxonomy redirect to override the Sources vocabulary
Enable the taxonomy redirect module. The admin screen for this module is a little confusing. Towards the bottom is a box labeled "Add new redirect" containing a bunch of input fields.
Select the Sources vocabulary. In the Path box enter 'feeds/!tid'. Click Submit, nothing else need be entered.
Entering this redirect causes the Sources vocabulary to use the view we just created.
Create a 'feed tags' view
I've found it helpful to create a sidebar block listing the terms in the Sources vocabulary. The idea is making it easy for the users to find the list of Sources in the directory.
Create a new view, this one is a 'Term' view, give it the name 'feed_tags'.
|Sort Criteria||Taxonomy term: ascending|
|Fields||Term ID, Term, making sure to list them in that order. In the Term ID field click on 'Exclude from display'. In the Term field click on the 'output this field as a link' and then enter "feeds/[tid]" after making sure the tid token is listed below.|
Now create a Block display for this view. Add a title of your choosing.
Then go to the blocks administration and add the block to your site. I like to limit the pages on which this block is displayed.
Add a 'Sources' menu item
It's also useful to add a menu item, perhaps in the Primary Links menu, to 'feeds' named 'Sources'.