Blog filtering by tags on main blog page

Hi There,
I’m very new to Hubspot. My background is mainly Wordpress and Joomla development. I want to find out if its possible to filter blog posts by tags on the main blog page and not have the them redirect to a new url when selecting a tag. I also want the tags to display as subnav items above the blog articles.
So for example if we have thefollowing tags: Baseball, Baseketball, Hockey etc I want to able to select the baseball tag and then show all relevent articles with the baseball tag on the main blog page instead of going to https://www.domain.com/baseball/
Are these two options possible and how do I implemented them

@SLombard8 - yes, this is possible of course. The way you present it to the user may vary. For example, I developed a case where baseball/basketball etc. were presented as tabs on the main listing page and each tab had a specific filter for the relevent blog posts. The code for the detail of this post filtering is a pretty standard HubL function as I recall.

I’m pretty new to Hubspot. Where can I get the code and where should I implement it?

Hi @SLombard8

I hope this will help you to resolve your query.

{% if content.tag_list %}

 {% 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 %}
{% endif %}

And then you can style it as you want.
To know more in detail you can refer to these two documents:- HubL Tags for blog tags & documentation for Blog Templates.

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

Hi @SLombard8, welcome to the Community!

Based on my experience building Blogs on HubSpot, I encourage you to use the /tag/ URLs and not try to modify the default functionality. While you can achieve what you are trying to do by using different HubSpot functions and filters, it will come at a performance and escalability cost.

I’ve worked in Blogs with thousands of articles and HubSpot has some limitations when it comes to displaying content in a customized way. For example, the function blog_recent_tag_post has a limit of 100 articles and 10 calls per page. You could load up to 1000 articles, but with a huge performance impact which might affect your visitors experience and importart metrics such as conversions.

If you are migrating from another CMS to HubSpot CMS, you can set up dynamic redirects to make sure users go to the correct /tag/ URLs if you had a different format before.

I truly encourage you to use HubSpot’s default functionality as it will prevent you from headhaches and unnecesary challenges in the near future :slightly_smiling_face:

Hi @albertsg. If I use the native Post Filter for blogs in hubspot is there a way to display the filter next to each other instead of listed?
Regards