CMS Development

victorwu
Participant

i want to show tags list, and have count of how many in use, like picture i post

hello i want to create a tags list like this and i can't find any code in hubspot can to count tags in used. please help me to figure out any way can do.

螢幕快照 2019-08-09 下午3.36.32.png

let is my code in here

螢幕快照 2019-08-09 下午3.44.05.png

0 Upvotes
3 Replies 3
piersg
Key Advisor

i want to show tags list, and have count of how many in use, like picture i post

A bit late here but for anyone else, {{item.live_posts}} in the blog_tags for loop returns the number of posts per tag. So for the above example

{% set my_tags = blog_tags('default', 250) %}
<ul>
{% for item in my_tags %}
  <li><a href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }} ({{item.live_posts}})</a></li>
{% endfor %}
</ul>

 

MFrankJohnson
Thought Leader

i want to show tags list, and have count of how many in use, like picture i post

Does the following code work?

<li class="tag_item"><a href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }}</a> ({{ item|length }})</li>

- see HubL supported filters

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
0 Upvotes
victorwu
Participant

i want to show tags list, and have count of how many in use, like picture i post

Hello 

it no work for me, doesn't count any on tag list.

螢幕快照 2019-08-09 下午9.54.12.png

0 Upvotes