CMS Development

IPars
Participant

Display tags on a blog post

SOLVE

I'm a HubSpot novice developing a blog and am trying to get the tags I've assigned to a post to appear on the post once published. Ideally they should be clickable (i.e., go to another page listing all of the blogs using that tag). From the bit of reading I've done it sounds like HubL is required? Thanks!

0 Upvotes
1 Accepted solution
albertsg
Solution
Guide

Display tags on a blog post

SOLVE

Hi @IPars, this is possible and yes, HubL is required.

 

If you check Hubspot's Blog template markup documentation, there's a great example that does exactly what you need.

 

{% if content.tag_list %}
    <div class="blog-post__tags">
      {% icon name="tag" style="SOLID" %}
      {% for tag in content.tag_list %}
        <a class="blog-post__tag-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a>{% if not loop.last %},{% endif %}
      {% endfor %}
    </div>
{% endif %}

 

The previous code should loop through all the tags assigned to your blog post and will display a link to the tag page.

 

 



Did my answer help you? Mark it as a solution


Do you need help with your site? Book time with me:


Book time with Albert

You can also connect with me on LinkedIn



View solution in original post

3 Replies 3
IPars
Participant

Display tags on a blog post

SOLVE

Thanks so much Albert, worked like a charm! Have a great weekend.

Jaycee_Lewis
Community Manager
Community Manager

Display tags on a blog post

SOLVE

Hey, @IPars. Thanks for letting us know that worked 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
albertsg
Solution
Guide

Display tags on a blog post

SOLVE

Hi @IPars, this is possible and yes, HubL is required.

 

If you check Hubspot's Blog template markup documentation, there's a great example that does exactly what you need.

 

{% if content.tag_list %}
    <div class="blog-post__tags">
      {% icon name="tag" style="SOLID" %}
      {% for tag in content.tag_list %}
        <a class="blog-post__tag-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a>{% if not loop.last %},{% endif %}
      {% endfor %}
    </div>
{% endif %}

 

The previous code should loop through all the tags assigned to your blog post and will display a link to the tag page.

 

 



Did my answer help you? Mark it as a solution


Do you need help with your site? Book time with me:


Book time with Albert

You can also connect with me on LinkedIn