adding previous and next blog article

adding previous and next blog article

TBS2023
Shopify Partner
152 1 9

https://yogaspirit.mu/blogs/bien-etre/le-yoga-du-visage-au-feminin

 

Hello - i would like to be able to have the next and previous articles visible on each of my blog posts.

 

Replies 5 (5)

LuffyOnePiece
Shopify Partner
637 92 116

Hi @TBS2023 ,

 

You can use below liquid code for next and previous.
{{ blog.previous_article.url }}

{{ blog.next_article.url }}

https://shopify.dev/docs/api/liquid/objects/blog

 

Let me know if you need further assistance.

 

Thank you

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184
TBS2023
Shopify Partner
152 1 9

where shall i add this please?

LuffyOnePiece
Shopify Partner
637 92 116

Hi @TBS2023 ,

You can use {{ blog.previous_article.url }} and {{ blog.next_article.url }} only on the blog page.

 

If you want to add the next and previous article in the article page, it is not possible using the liquid code.

 

You either need to use third party app or build your own custom app.

 

Let me know if you need any assistance.

 

Thank you

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184
TBS2023
Shopify Partner
152 1 9

ok but on what page...i have a few blog pages

TBS2023
Shopify Partner
152 1 9

So i have managed to add this code

 

<div class= row>
{% if blog.next_article != nil %}
<div style= "float: right; clear: right;">
<a href="{{ blog.next_article.url }}"><h3> Article Suivant >> </h3>



</a>

</div>
{% endif %}

{% if blog.previous_article != nil %}
<div style= "float: left; clear: left;">
<a href="{{ blog.previous_article.url }}"><h3> << Article Précédent </h3></a>

</div>
{% endif %}

</div>

 

 

Is there a way to show the blog image as well?