Show related tags for a specific blog

Hey guys, I have been looking everywhere, all over google and this place. But I can’t find the answer - all I want to show is the tags on a specific post.

The only code I can find is the following, but it displays EVERY single tag, not the tags which are assigned to this blog.

<div id="tag-cloud">
<h3>Tags</h3>
{% set my_tags = blog_tags('default', 10000) %}
<ul class="cloud" role="navigation" aria-label="Ucidity tag cloud">
{% for item in my_tags %}
<li><a data-weight="{{item.live_posts}}" href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }} ({{item.live_posts}})</a></li>
{% endfor %}
</ul>
</div>

Hi @SimonJb11, this is what you’re looking for:

<div id="tag-cloud">
<h3>Tags</h3>
<ul class="cloud" role="navigation" aria-label="Ucidity tag cloud">
{% set my_tags = blog_tags('default', 250) %}
{% for topic in content.topic_list %}
 {% for item in my_tags %}
 	{% if item.slug == topic.slug %}
 		<li><a data-weight="{{item.live_posts}}" href="{{ blog_tag_url(group.id, topic.slug) }}">{{ topic.name }} ({{item.live_posts}})</a></li>
 	{% endif %}
 {% endfor %}
{% endfor %}
</ul>
</div>

Basically you loop over the content topic list, and then use a nested for loop over all your tags and compare an attribute (I used slugs) to make sure you’re matching the right items in the loops and display the number of live posts if you are.

Thank you very much!

@SimonJb11 just a quick optimisation/cleanliness thought, it would probably be better to have the my_tags variable set before the first loop. You don’t need to re-set it for every topic of the blog article

{% set my_tags = blog_tags('default', 250) %}
{% for topic in content.topic_list %}
 {% for item in my_tags %}
 ...
 {% endfor %}
{% endfor %}