I have a view of all of the terms in a vocabulary. How can I in the same view list the number of tagged nodes for each term? Thanks
2 Answers
First you have to make sure you can get the nodes tagged with each term to display, and then we'll get them so their COUNT is listed.
- Add the 'Taxonomy term: Content with term' Relationship to your terms view (under the 'Advanced' section)
- Now you should be able to see, in the list of fields, things such as Content: Title, etc. Add the content title, and make sure it's set to use your newly created relationship.
This should get all the nodes tagged with each of your terms to be displayed under the term. But how to count them??
The way you can do that is by enabling the use of aggregation for your view! Under the 'Advanced' section of your view, locate the 'Use aggregation' setting and make sure you enable it. It's disabled by default:
Once you've done that, you'll see by all of your fields a new 'Aggregation settings' field, which you can set to be 'Count' for the node title that relate to each taxonomy term.
That should do it! Let us know if you get it working! :-)
If the tag name is a contextual filter, there is also another alternative:
Go to the view's contextual filter definitions
On the resulting popup, check the 'Dispay a Summary' radio option:
Notice that the 'Display record count with link' option is checked by default.
- Press 'Apply' to save the changes.