How to display the node count values for taxonomy terms using Views
In this post I am sharing, how to display node count values for taxonomy terms using views. We have implemented this to quite a few blog site where we had to show number of blogs published in specific categories. In this example I have created one content type "story-Book" & taxonomy as "Book-tag"
Step 1: Add the field “Content: Book-tag” available in my “story-Book” Content type.
Step 2: Add another field "Nid"
Step 3: Make sure we are counting only published content type, select “Content: Published“ as Yes in Filter Criteria
Step 4: Under Filter Criteria add “Content: Type“ as “story-book” of which we want to count the number
Step 5: Under relationships, add taxonomy terms: content with term
Step 6: Under contextual filter, add taxonomy term: name, choose "Display a summary", "Display record count with link"
We are done. Check the updated review to view terms with node count. Do not forget to save the view
Step 7: Now just assigned the view block to region you want to display. I have assigned the block to left sidebar.
This is one of the way we can do this. There are few more options in views which can be used to achieve similar result. Will explore more in next post. Do contact us if you would like us to help you on your next Drupal project.