I am currently facing an issue related to displaying Blog Details on the Blog Listing page. I see that HubSpot provides a variable called Contents, which I use to loop through and display blog posts on the listing page. However, there is a problem where I want the option to hide a Blog Detail so that it no longer appears on the listing page. To achieve this, I created a field called content.widgets.blog_config.body.show, and I check if it’s false, then the post is not rendered on the Blog Listing.
However, the issue I’m encountering is that the Contents variable has a fixed number of posts per page. So, when I hide a blog detail on page 1, that page shows only 11 posts, while the other pages still display 12 posts. What I want is that when I hide a post, the subsequent posts should shift up so that page 1 still displays 12 posts, and the last page will have one post less. How can I achieve this?
This is sadly not possible. The amount of posts per page in the contents variable is determined in the blog settings, and this can not be changed.
The alternative is retrieving the blog posts through the HubL function blog_recent_posts and calculating which posts you need to retrieve from the next page to display on the page where a post is hidden, this is however, quite a hacky solution, and not really fool proof.
What we normally do when a post is hidden on a page, is display another resource, like a nice CTA or a custom card linking to a webinar/podcast for example. But I can imagine that this isn’t going to work either if you have multiple blog posts hidden on a single page.
Agree to what @Teun had to say. There may be hacky ways to work around it but it probably won’t be the best long-term outcome in this case.
Another thing to consider is creating a separate blog in your HubSpot portal and moving those “hidden” blog posts there. If the goal is not to have those posts available to the public, you can also utilize the Memberships functionality that will require users be a part of an access group in order to view them.