Forum

Thread tagged as: Question, Blog

Is there a way to list blog tags in order of popularity and limit to a specific...

I believe you can do this with categories by using categoryPostCount but I couldn't see anything similar for tags.

To clarify I'd like to sort tags by popularity (qty) and then only list the top 5. eg:

  • People (5)
  • Animals (4)
  • Cars (3)
  • Buildings (2)
  • ....
Jonathan Clift

Jonathan Clift 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have the tag could displaying? If so, you can check for it in the template with a perch:if tag.

Do you mean tag 'count'? I do have that displaying but I'm not sure why checking for it would order them by popularity (qty) and limit the number displayed. Am I missing something?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sorry, I thought you wanted to display only tags above a certain count.

I'm not sure I can help.

No worries. I might just amend the query in your tags class. (Not advised I know) but I'll just have to make note that it will get overwritten on an update. Will put it in as a suggestion for future reference.

Also, just a heads up I noticed a broken link on the https://docs.grabaperch.com/docs/templates/conditionals/if/ page. At the bottom there is a link to "format" but it wasn't working.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, thanks.

I was just looking to do this exact process on my client's website. Sort the tags into descending count and then filter the list to show only the top 10 tags in the sidebar. -- Glen