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.

Adding  a Tag Field “Content: Book-tag”  available in my “story-Book” Content type

Step 2:  Add another field "Nid"

Add another field nid

Step 3:  Make sure we are counting only published content type, select “Content: Published“ as Yes in Filter Criteria

Select content published under filter criteria

Step 4: Under Filter Criteria add “Content: Type“ as  “story-book” of which we want to count the number

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

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"

Under contextual filter, add taxonomy term: name, choose "Display a summary", "Display record count with link"
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 

Node count preview
 

Step 7: Now just assigned the view block to region you want to display. I have assigned the block to left sidebar.

Node count achieved using views

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.

 

comments powered by Disqus