<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: related_blog_posts not pulling related posts in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1142619#M42861</link>
    <description>&lt;P&gt;Edit: It was not displaying one pages with multiple tags as I was iterating through a string of tags not the array content.tag_list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Changing that and making sure "blog_post_override" is passed in as "{{ stringvar }}" has worked.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Apr 2025 11:38:00 GMT</pubDate>
    <dc:creator>JSheales</dc:creator>
    <dc:date>2025-04-30T11:38:00Z</dc:date>
    <item>
      <title>related_blog_posts not pulling related posts</title>
      <link>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1140741#M42804</link>
      <description>&lt;P&gt;I have a blog post page template, using the related_blog_posts hubl tag at the bottom. However it is not actually pulling posts that are related. I have tried two methods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This one is just taking the tags of the post, removing the year tag we have, as I only want to use the other tags, and passing that in to the hubl tag. Out of the 3 at most only 1 is actually related.&lt;/P&gt;&lt;PRE&gt;{% set tags = content.tag_list | join(',') %}

{% set tags = tags | cut('2025') %}
{% set tags = tags | cut('2024') %}
{% set tags = tags | cut('2023') %}

{% related_blog_posts limit=3, tags=tags, tag_boost="100" no_wrapper=True, post_formatter="recent_post" %}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried using hubl, to get the ids of 3 posts with the first tag, and pass the ID directly into the `blog_post_override` argument. This still does not display the selected posts.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;{% set tags = content.tag_list | join(',') %}

{% set filteredTags = [] %}
{% for tag in tags %}
	{% set len = filteredTags | length %}
	{% if len &amp;lt; 10 and tag != "2025" and tag != "2024" and tag != "2023" %}
		{% set tag = tag | lower %}
		{% set tag = tag | replace(" ", "-") %}
		{% do filteredTags.append(tag) %}
	{% endif %}
{% endfor %}

{% set posts = blog_recent_tag_posts("default", filteredTags, 5, "AND") %}
{% set filteredPosts = [] %}
{% for post in posts %}
	{% if content.id != post.id %}
		{% do filteredPosts.append(post.id) %}
	{% endif %}
{% endfor %}
{% set filteredPosts = filteredPosts | join(",") %}

{% related_blog_posts limit=3, blog_post_override=filteredPosts, post_formatter="recent_post", no_wrapper=True %}&lt;/PRE&gt;&lt;P&gt;I have also tried this without the hubl, and just manually writing in the ids like "id1,id2,id3", still with no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or ideas would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 10:08:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1140741#M42804</guid>
      <dc:creator>JSheales</dc:creator>
      <dc:date>2025-04-25T10:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: related_blog_posts not pulling related posts</title>
      <link>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1140921#M42806</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/934257"&gt;@JSheales&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;In your related_blog_posts call, I see the value of post_formatter="recent_post" but I don't see any macro with that name in your code.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;See the example in the boilerplate:&amp;nbsp;&lt;A href="https://github.com/HubSpot/cms-theme-boilerplate/blob/fbc829d502d53b75c2d7dadf160402f77cf2d863/src/templates/blog-post.html#L82" target="_blank"&gt;https://github.com/HubSpot/cms-theme-boilerplate/blob/fbc829d502d53b75c2d7dadf160402f77cf2d863/src/templates/blog-post.html#L82&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;As you can see, it's using the macro "&lt;A href="https://github.com/HubSpot/cms-theme-boilerplate/blob/fbc829d502d53b75c2d7dadf160402f77cf2d863/src/templates/blog-post.html#L56" target="_blank" rel="noopener"&gt;related_posts&lt;/A&gt;" to format the output of the function related_blog_posts.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Since you are missing it in your code (at least in the part you shared), maybe the issue is there.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here's another link with more information:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/tags/related-blog-posts" target="_blank"&gt;https://developers.hubspot.com/docs/reference/cms/hubl/tags/related-blog-posts&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Let me know if that helps!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 15:39:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1140921#M42806</guid>
      <dc:creator>albertsg</dc:creator>
      <dc:date>2025-04-25T15:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: related_blog_posts not pulling related posts</title>
      <link>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1142606#M42860</link>
      <description>&lt;P&gt;Hiya &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/92197"&gt;@albertsg&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yhh thats not the issue, I didn't include the recent_post macro in the code as it was not relevant to the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My posts are displaying as intended, its the actually finding related posts that is the problem. The module is fetching 3 seemingly random posts.&lt;BR /&gt;&lt;BR /&gt;I did however change my second solution to pass in the filteredPosts as a string like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{% related_blog_posts limit=3, blog_post_override="{{ filteredPosts }}", post_formatter="recent_post", no_wrapper=True %}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This has fixed it actually displaying the manually filteredPosts, but the "blog_recent_tag_posts" query does not always return related posts now, even after replacing "AND" with "OR" and manually checking that there are posts with that tag that should show.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 10:55:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1142606#M42860</guid>
      <dc:creator>JSheales</dc:creator>
      <dc:date>2025-04-30T10:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: related_blog_posts not pulling related posts</title>
      <link>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1142619#M42861</link>
      <description>&lt;P&gt;Edit: It was not displaying one pages with multiple tags as I was iterating through a string of tags not the array content.tag_list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Changing that and making sure "blog_post_override" is passed in as "{{ stringvar }}" has worked.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 11:38:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/related-blog-posts-not-pulling-related-posts/m-p/1142619#M42861</guid>
      <dc:creator>JSheales</dc:creator>
      <dc:date>2025-04-30T11:38:00Z</dc:date>
    </item>
  </channel>
</rss>

