Issue with Recent Blog Posts Module Not Showing Descriptions

Hi everyone,

I’m currently developing a “Recent Blog Post” module in HubSpot and am encountering an issue when trying to fetch blog content using the post_list_content function. My goal is to display a truncated version of each post’s description, but I’m running into a problem with the post_list_content.

{% set rec_posts = blog_recent_posts(module.choose_blog, module.number_of_blog_you_want_to_fetch) %} {% for rec_post in rec_posts %} <div> {{ rec_post.post_list_content | striptags | truncate(150, true) }} </div> {% endfor %}

The code works as expected when used on a blog listing page. However, when I use it within the recent blog post function, post_list_content doesn’t return the expected description.

Any insights or advice would be greatly appreciated!

Thank you!

Hi @jay_pinetco,

When trying to retrieve blog posts outside of the blog listing, you can use post_summary instead of post_list_content

{% set rec_posts = blog_recent_posts(module.choose_blog, module.number_of_blog_you_want_to_fetch) %}
 {% for rec_post in rec_posts %} 
 <div> {{ rec_post.post_summary | striptags | truncate(150, true) }} 
 </div>
 {% endfor %}

Hope this helps!