CMS Development

adam_jenkins
Membro

Adding most recent blog titles with links to blog pages

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 %}

0 Avaliação positiva
1 Resposta 1
AJLaPorte_diagr
Conselheiro(a) de destaque

Adding most recent blog titles with links to blog pages

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

 

 

0 Avaliação positiva