Add noindex tag to collection paginated pages

Topic summary

A user seeks to add a “noindex” meta tag specifically to paginated collection pages (e.g., URLs containing “?page=”) in their Shopify theme, while keeping main collection pages indexed.

Initial Problem:

  • Attempted solutions using collection.handle contains '?page=' failed because the query parameter isn’t part of the collection handle
  • Alternative approaches using current_tags or current.filters incorrectly applied noindex to all collection pages

Working Solution:
Another user provided code that successfully targets paginated pages:

{% if canonical_url contains '?page=' %}
<meta name="robots" content="noindex" />
{% endif %}

This approach checks the canonical_url variable instead of collection properties, which correctly identifies paginated URLs.

Status:

  • Solution confirmed working by multiple users
  • Implementation question raised about placement (likely theme.liquid file)
  • Thread appears resolved with the canonical_url method
Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

Hi,

I have searched a lot for a solution to add a noindex by editing theme.liquid file to add “noindex” to paginated pages of collections, but don’t think there is a solution and if there is then those pages are archieved.

Example: https://www.example.com/collections/example-category?page=4

I’m specifically looking to noindex all collection that contains '?page=" but unable to.

This is what I’m currently at, but not working

{% if template contains ‘collection’ and collection.handle contains ‘?page=’ %}

{% endif %}

If I try the below, it adds noindex to all the collections as well, which I do not want.

{% if template contains ‘collection’ and current_tags %}

{% endif %}

or

{% if template contains ‘collection’ and current.filters != blank %}

{% endif %}

Please only reply if you can provide a solution to the above. Thanking heaps in advance.

P.S: I’m not looking for a canonical solution, that thing is already working. Thanksssss

1 Like

Hi @anksnz007

I have been trying to do the same but could not achieve the result and then I used the following code which got me the result I wanted. Please try it.

{% if canonical_url contains ‘?page=’ %}

{% endif %}

Let me know if this works. It worked for me.

Best Regards,

Harsha

Web Developer

2 Likes

Thanks, it worked for me too…

1 Like

Hallo, where should i add this exactly in my code? theme.liquid?