Apr 21, 20215:45 AM - edited Apr 21, 20217:49 AM
Guide
Variable {{contents}} not showing anything
SOLVE
Hello everyone!
I have an issue with templates and the variable {{contents}} that is driving me crazy. The issue is that this variable is null when called from a partial template but it works in the parent template.
My template structure is the following:
Main HTML template --> Secondary HTML --> Third HTML
Where each HTML is imported from the partent HTML (main imports secondary and secondary imports the third one).
The main HTML is our template file that we will select when creating the portal/blog. The secondary HTML is a file that, according to the URL the user is in, will load one or another template. The third template is a template used for a blog post that we don't use as a blog post but as a listing page for a specific category (we create a blog post, we use modules to select the type of page it will be and according to that, it loads this third HTML file or another one).
The variable {{contents}} works in the main and the secondary HTML files, but is not working (empty) in the third one.
After reading Hubspot's documentantion, I understand I need templateType: blog in order for {{contents}} to work.
This is the configuration markup of the first template ({{contents}} works) :
This from the second ({{contents}} works) :
And this from the third ({{contents}} doesn't work) :
So my question is, why it is working in the two first templates and not in the third one?
I've tried playing around with the templateType and move it to blog_listing but doesn't help.
I believe it has something to do with the fact that the third template is a blog post (even if we use it as a listing page) and the other two are loaded into the blog homepage.
If that's the issue, how can I fix it to make {{contents}} work in my blog post also?
If you are wondering why I need to use {{contents}}, the reason is because if you need to list +200 articles, this is the only variable that allows you to do it (the others are limited to 200 articles).
@albertsg I believe the contents object is only available in templates designated for blog listings. You might be able to use the "all" posts page which gives you access to 1000 posts at a time but the downside to using that is you have to use the /all appended to the main blog URL and you can't change it.
@albertsg I believe the contents object is only available in templates designated for blog listings. You might be able to use the "all" posts page which gives you access to 1000 posts at a time but the downside to using that is you have to use the /all appended to the main blog URL and you can't change it.