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)
{# 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 %}
Jul 24, 20185:09 AM - edited Jul 24, 20185:14 AM
Member
Multiple filters in blog
SOLVE
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)
{# 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 %}