Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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=' %}
<meta name="robots" content="noindex, follow" />
{% 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 %}
<meta name="robots" content="noindex, follow" />
{% endif %}
or
{% if template contains 'collection' and current.filters != blank %}
<meta name="robots" content="noindex, follow" />
{% 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
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=' %}
<meta name="robots" content="noindex" />
{% endif %}
Let me know if this works. It worked for me.
Best Regards,
Harsha
Web Developer
Hallo, where should i add this exactly in my code? theme.liquid?
Thanks, it worked for me too....
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025