Kevin J Morse.ca - Most Popular Tags in Drupal using Views

I wanted to add a sidebar block showing the most popular tags on the site but didn't want to use any extra contributed modules. It turns out it's actually quite easy to do using Views.

  1. Download and install Views if you don't have it already.
  2. Create a view to Show Taxonomy Terms and click Create a block if you want the sidebar block.
  3. Click Advanced and add a Relationship to Taxonomy term: Content using Tags
  4. In Advanced under Other set Use aggregation to yes.
  5. Add the Taxonomy term: Name field twice. Set the aggregation settings of the first to Group results together and the second to Count.
  6. You can add a Prefix and Suffix of ( and ) so that the number of times the Tag appears is in parenthesis.

Enjoy!

Comments

thanks for giving the correct way to add sidebar.

You're welcome!

Thanks Kevin! The steps above worked for me, but step 5 is a little unclear. The following modification worked for me:

5. Add the "Taxonomy term: Name" field twice. Set the first to aggregate by "Group by", and the second by "Count". I also added a prefix of " (" and suffix of ")" to the second field, such that the output of a single term looks something like: hamburgers (5)

Also in Show: Fields > Settings, check the two fields under "Inline fields" to get them to appear next to each other, or alternatively set up some form of Rewrite.

I made this change to the instructions.