We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Mar 21, 2018 12:34 PM
At the bottom of my blog pages, I am trying to add a section for most the 3 recent posts that match the topic / category of the blog you are on. I would like it to display the blog title that is a link to that specfic blog.
I was trying to use HubL functions to accomplish this... ?
{% set pop_posts = blog_popular_posts('default', 3, 'manufacturing') %} {% for pop_post in pop_posts %}
<div class="post-title"><a href="{{ blog_tag_url('default') }}">{{ pop_post.name }}</a></div>
{% endfor %}
Mar 21, 2018 4:45 PM - edited Mar 21, 2018 4:47 PM
Hey Adam_Jenkins,
It looks like you're using the popular posts function and not the recent posts function. This is the recent posts by topic function: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-recent-topic-posts
If you are looking to use popular posts, try:
{% set pop_posts = blog_popular_posts('default', 3, 'manufacturing') %}
{% for pop_post in pop_posts %}
<div class="post-title"><a href="{{pop_post.url}}">{{ pop_post.name }}</a></div>
{% endfor %}
you can also use the developer info link from the HS Sprocket Icon to view certain variables to use:
https://designers.hubspot.com/docs/hubl/how-to-use-developer-info-on-cos-pages