CMS Development

m_engineer
Miembro

How do I retrieve the previous and next articles?

Is there a way to use the Hubl function or something similar to get the previous and next posts of a blog?
I would like to incorporate this into the template if possible.

0 Me gusta
1 Respuesta 1
Anton
Experto reconocido

How do I retrieve the previous and next articles?

Hi @m_engineer

you can use following Hubls to get the informations about the next/previous blog posts

{{ content.next_post_featured_image }} {# shows the featured image of the next post if one exists #}

{{ content.next_post_featured_image_alt_text }} {# the alt-text for the next image #}

{{ content.next_post_name }} {# diplay the name of the next post #}

{{ content.next_post_slug }} {# the link to the next post #}

{{ content.previous_post_featured_image }} {# shows the featured image of the previous post if one exists #}

{{ content.previous_post_featured_image_alt_text }} {# the alt-text for the previous image #}

{{ content.previous_post_name }} {# diplay the name of the previous post #}

{{ content.previous_post_slug }} {# the link to the previous post #}

 

you can find more build-in blog Hubls here

 

Another way could be to create a custom blog listing module which displays X(most likely 3-4) posts of the particular blog with "blog_recent_posts" which will automatically show the newest X number of posts of the blog. With a little bit of HTML and CSS you can display them as cards below each post.

 

 

best, 

Anton

Anton Bujanowski Signature
0 Me gusta