Taxonomy and Views in Drupal - Create tag block per section page

BlocksProviding a quick way for visitors to find additional information they are interested in has been a major focus while working on this project. Requirements were few but critical to meet. The solution: Taxonomy linked key phrases to posts while Views provided a method of displaying the terms.

The decision on how to arrange Libraries was crucial in allowing Taxonomy to function properly.  I needed the ability to break terms into sections on each main page, while having terms be independent of content type or page postings, due to the nature of the site having topics that overlap.  One Taxonomy Library with Tags being inserted by the author worked best for this situation.  Terms representing the major sections of Try2Stop.Us were added, then used as parent terms for tags fitting the section. 

To display Taxonomy Terms on desired pages create a view, in this case I named it "tag_view_list" since it was a view displaying tags and was originally in list format, which has changed to grid however. Choose Term view type, this will cause the query to use the taxonomy table as the primary source. Under default select the layout that works best, add the field "taxonomy term" and create a relationship by pressing the + button next to relationship and select the "parent term" checkbox. You also want to add a filter to default "Taxonomy: Vocabulary" and select the vocabulary(s) that will be displayed.

Now you want to create blocks to use on various pages. On the drop down menu located on the left side of the view administration node select block and click the add display button below it. Make sure you change the name so you can easily find it when administering blocks. To display all items in the selected vocabulary leave the block as is, preview it to make sure the correct data is being returned. If you would like to  create a block showing all child terms of a certain tag on a page select block from the drop down and click the add display button one more time. Now all you need to do is change the name of the block for good organization, click the filters link and subsequent override button to use different settings than the default. Now add a filter selecting "(parent) Taxonomy Term = YourParentTerm" subsituting 'YourParentTerm' with the actual parent term desired.

The plus side to this method is the ease of setup and ability to have terms overlap between areas that would be separated using other methods. The downside is that you will need to find a way to automate tags being marked as child items of the parents or manually sort them. This is not an issue for this site due to having a small number of authors and posts, however I wouldn't recommend using it for a large user generated content site.


I can be reached for comments, questions or ideas on twitter @Try2StopUs

Try2Stop.Us | Contact Us | Log In | Try2Stop.Us © 2011