CMS Development

albertsg
Guide

Get ALL blog posts from my blog

Hello community, hope someone can help me here.

 

I have an issue while trying to display ALL blog posts from my Blog. 

To put you in context, we have a live page that is currently using the blog_recent_posts functionality to get a list of blog posts for our listing pages (we have several listing pages in the same Blog as we have different categories, etc.).

 

Everything was fine until we had +200 articles published. It was at that moment that we realized this functionality is not good since blog_recent_posts has a limit of 200 posts, so we had to find another solution. 

Checking Hubspot's documentation, seems like the only variable that stores ALL articles is {{contents}}, so I decided to give it a try. It seems to work for some listing pages but for others not.

 

Hubspot told me that in order to use the variable {{contents}} we have to set up the 

templateType variable to "blog". Surprisingly, this variable works also in a template with templateType: "page", so not sure if this is the main problem... Anyway, the problem here is that our listing templates are used in hundreds of pages so Husbpot doesn't allow us to change the templateType.
 
So, in order to try to fix that, I've tried the following:
 
- Clone the template, change the templateType in the clonned template and make the pages use the new template. It didn't work.
- Store {{contents}} as a variable in another HTML file where it should work (like this: {% set blogs = contents %} ) and then use the import functionality to import the variables of this template. It didn't work, all variables are working fine except the one that I assign the value of contents.
 
So my question here is, does anyone know an alternative way to display ALL blog posts from a Blog even if the templateType is set to "page"? 
 
Thank you for your help!


Did my answer help you? Mark it as a solution

You also connect with me on LinkedIn or Twitter

0 Upvotes
2 Replies 2
albertsg
Guide

Get ALL blog posts from my blog

Hello @dennisedson , unfortunately I couldn't find a proper solution yet. 

I've been told to use several instances of the blog_recent_posts function but it seems more like a temporary solution rather than a proper long term solution as we need to increase the instances according to the number of articles and that number is constantly increasing.



Did my answer help you? Mark it as a solution

You also connect with me on LinkedIn or Twitter

dennisedson
HubSpot Product Team
HubSpot Product Team

Get ALL blog posts from my blog

@albertsg ,

Have you made any headway with this?

@Anton , do you have any suggestions 😬

0 Upvotes