Views Aggregation to count nodes tagged by terms
You can use Views Aggregation to count the number of nodes that each tag is assigned to, and use that as the Sort criteria.
- In the Views of type
Taxonomy term filter all the terms you're interested about. Add a Name Field to show the term name (you probably already have that covered)
- Add a Relationship to the content that the terms are related to Content using field_yourname
- Turn on Aggregation (Under Advanced, third column)
- Add a
Sort criteria Content: Title, (it will automatically use the Relationship from above), Sort descending and adjust its Aggregation settings to Count DISTINCT (if you allow nodes to use multiple terms then
Count will count them more than once)
Your terms list will be sorted by the number of nodes tagged by each term in your Views results.
Views Summary for single value fields
If your Taxonomy term reference Field allows for only one value you can use Views summary in a Contextual filter to count the nodes tagged with a term.
You can do it from Taxonomy term Views or Content Views.
- If starting from Taxonomy term Views you can use the above steps,
only instead of using Aggregation add a new Contextual filter
Taxonomy term Category and configure it to display a Summary:
When the filter value is NOT available
Display a summary
Sort order Descending
Sort by Number of records
Base path (you must enter the Page path if this isn't the first Page Display in your Views)
Display record count with link
This way you get a list of Taxonomy terms with node count next to them. When you click on them you go to another page listing the actual Fields you set up in Views (you'll probably want to list Content: Title here).
It's a similar procedure to do that from Content Views type.
- You'll want to add a Relationship to the relevant Taxonomy field (Taxonomy term referenced from field_yourname),
- then add a Contextual filter for
Taxonomy term: Name, use the Relationship and configure it to display as a Summary.