Hi,
I am a developer and have built quite a bunch of blog templates but I have not tried multiple filters.
Is this possible to achieve in hubspot?
Hi,
I am a developer and have built quite a bunch of blog templates but I have not tried multiple filters.
Is this possible to achieve in hubspot?
Hi @hananizzi
The multiple tiers, or axis, of topics/tags isn’t built into HubSpot - it has only one level of tags that cannot be nested.
You may be able to overcome this with some manual topic grouping and sorting in the front-end, but it isn’t supported natively by the blogging tool.
Hope this helps.
If I get you right, you want to find a match for a topic in all the blogs.
To achieve this, I would do this.
Imagine you have these topics/tags:
North America (hubspot gives it value north-america automatically, also called slug)
Consumer Goods (consumer-goods)
Large Enterprise (large-enterprise)
Topic slugs use dashes instead of spaces.
So now if we want to filter all blogs that have above 3 tags, we should compose url like this:
http://456456465.hs-sites.com/samplepage?topics=north-america|consumer-goods|large-enterprise
Then do this in your custom hubl module:
{# Check if top parameter exists in url querystring #}
{% if request.query_dict.topics %}
{# Reconvert it into string and split by | separator #}
{% for reqParam in request.query_dict.topics|string|split('|') %}
{% set filteredTopicPost = blog_recent_topic_posts('5884432148', reqParam) %}
{# Loop through each of the post #}
{% for blogPost in filteredTopicPost %}
{# Check if blogpost was found #}
{% if blogPost %}
{# Loop through each tag of the current post #}
{% for blogTopic in blogPost.topic_list %}
{% if blogTopic.slug == reqParam %}
Match Found for Blog: {{ blogPost.title }} <br>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
If I get you right, you want to pull all blogs that matches topic/tag, then I would do this:
Imagine you have these topics/tags:
North America (hubspot gives it value north-america automatically)
Consumer Goods (consumer-goods)
Large Enterprise (large-enterprise)
Topic slugs use dashes instead of spaces.
So now if we want to filter all blogs that have above 3 tags, we should compose url like this:
http://444462.hs-sites.com/samplepage?topics=north-america|consumer-goods|large-enterprise
Then in your custom hubl module:
{# Check if topics parameter exists in url querystring #}
{% if request.query_dict.topics %}
{# Reconvert it into string and split by | separator #}
{% for reqParam in request.query_dict.topics|string|split('|') %}
{% set filteredTopicPost = blog_recent_topic_posts('5884432148', reqParam) %}
{# Loop through each of the post #}
{% for blogPost in filteredTopicPost %}
{# Check if blogpost was found #}
{% if blogPost %}
{# Loop through each tag of the current post #}
{% for blogTopic in blogPost.topic_list %}
{% if blogTopic.slug == reqParam %}
Match Found for Blog: {{ blogPost.title }} <br>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
The solution presented works if you’re looking to match based on if the posts have ANY of the topics in the URL.
What if you want to filter by posts that have ALL of the topics listed in the URL?
Hi,
I would like to mention that the solution is outdated. You can create a filter on a blog-template.
https://community.hubspot.com/t5/CMS-Development/Custom-Blog-Listing/m-p/445781#M23567