FROM CACHE - en_header

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

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 %}
<link rel="next" href="{{ shop.url }}{{ }}" />
{% endif %}

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



Replies 4 (4)
Shopify Staff
Shopify Staff
5827 1 369

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

4 0 1

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 :

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


Thanks in advance for your help, best regards

Shopify Expert
861 33 220

@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):
4 0 1

Hello Josh,


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

Have a great day,