Pagination with rel=“next” and rel=“prev”

Hannah_West
New Member
11 0 0

I am trying to implement Google's Pagination with rel=“next” and rel=“prev” and am following the instructions from this post on the subject.

I just want to clarify exactly what code Caroline is talking about when she writes this in her last comment:

place the paginate tag {% paginate X by Y %} ...  in theme.liquid inside the <head>

I understand that the "paginate tag" she mentions plus this code:

{% if paginate.previous %}
<link rel="prev" href="{{ shop.url }}{{ paginate.previous.url }}" />
{% endif %}


{% if paginate.next %}
<link rel="next" href="{{ shop.url }}{{ paginate.next.url }}" />
{% endif %}

needs to be placed in the in theme.liquid inside the <head> tag for it to work.

Thanks,
Hannah

 

0 Likes
Caroline_Schnap
Shopify Staff
Shopify Staff
5705 1 354

As far as I understand it's not possible to place the paginate block within the head in theme.liquid. So you'll need to forgive me for suggesting to do that. In conclusion, you won't be able to add prev and next links to your collection pages. 

Caroline_Schnap | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Maelb22
New Member
4 0 0

Hello Caroline,

 

Now, is it possible to add tag rel="prev" and rel="next" in the head of a shopify website, for collection page pagination ?

 

I tried to do that as defined in the chapter "pagination markup" in the following link : https://www.digitaldarts.com.au/expert-guide-shopify-seo-tips#audit-site-architecture

But it does not work for me, I think so.

 

Thanks in advance for your help, best regards

0 Likes

@Maelb22 You've linked to one our SEO guides in your post. There's nothing you need to do to implement rel next and rel prev canonical tags on collection pages because the mark up is handled through {{ content_for_header }}.

There's a tiny chance your theme is different so it may help to post a collection URL here to be analyzed.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
0 Likes
Maelb22
New Member
4 0 0

Hello Josh,

 

Thanks for the response. Effectively, everything is correct. I was analysed the code in a wrong way.

Have a great day,

 

Maël

0 Likes