I am creating a website using HubSpot CMS.
I’m creating a blog article list module, but I’m having trouble with it.
If anyone has any knowledge, I would like to hear from you.
■Summary
The module (HTML + Hubl) that displays a list of articles posted in a blog article was created while checking the developer documentation (HubL関数 - HubSpot docs).
The code is below.
<div class="popular_posts">
{% set pop_posts = blog_popular_posts("default", 5) %}
<div class="popular">
{% for pop_post in pop_posts %}
<a href="{{pop_post.absolute_url}}" class="popular-articles">
{% if pop_post.post_list_summary_featured_image %}
<img src="{{ pop_post.post_list_summary_featured_image }}" class="popular-articles-image" alt="{{ pop_post.featured_image_alt_text | escape }}">
{% endif %}
<h3 class="popular-articles-title">{{ pop_post.name }}</h3>
</a>
{% endfor %}
</div>
</div>
When I preview it from the module creation screen, it displays correctly, but when I place a module created with the design tool, nothing is displayed when I preview it.
■What I tried
- When I placed the module on another page, it was displayed correctly in this case. Based on this, I predict that the direct cause is that there is no article on the page where you are trying to place it, but is this understanding correct?
If anyone knows the cause, please let me know. If you need any other information, please feel free to contact us and we will share it with you.