CMS Development

subin
トップ投稿者 | Gold Partner
トップ投稿者 | Gold Partner

Hubspot related post filtering also loading posts from from two different blogs

Hi developers

I am trying to get the related posts from the blog using  related_blog_posts 

here is my code

<div class="post-bottom-content">                   
{% macro blog_post_formatter(blog_post) %}  
        <div class="prev-post cm-posts span6">
                <p>
                  <a class="previous-posts-link" href="{{ blog_post.absolute_url }}">
                    <img src="{{ blog_post.featured_image }}" alt="{{ blog_post.name }}">
                    {{ blog_post.name|striptags|truncate(300, breakword=False, end='...') }}
                  </a>

                </p>
              </div> 
{% endmacro %}
        
{% set tagNames = content.tag_names %}
  {{ tagNames }}
{#	Add this to the function and use HubSpot's JOIN filter to turn the array into a comma separated string	#}
<div class="recent-post-listing next-prev-posts">
<div class="recent-listing">
{% related_blog_posts blog_ids="xxxxxxxx" post_formatter="blog_post_formatter" limit="4", tags="{{ tagNames|join(',') }}" %}
</div>
<div style="clear:both;"></div>
</div>

</div>

I have added the blog ID to fetch the posts from a single blog, but its also loading posts from other blogs too, I didn't understand why this issue occurs even after I have added a particular blog ID. can anyone please help me to solve this situation? waiting for the reply

 

Thanks

0 いいね!
2件の返信
mherzog
HubSpot製品開発チーム
HubSpot製品開発チーム

Hubspot related post filtering also loading posts from from two different blogs

Hey there! This certainly seems odd- any chance you could send me a link to the blog you're testing this on (it's okay if the code isn't live) and I'll try to dig in a little deeper?

0 いいね!
elihermans
参加者 | Elite Partner
参加者 | Elite Partner

Hubspot related post filtering also loading posts from from two different blogs

I'm having the same issue, even with the most simple syntax : 

 

{% related_blog_posts, blog_ids="7734291241" %}

 

 

 

0 いいね!