How to noindex pagination pages

957 Views Asked by At

How to I add a noindex tag to pagination pages for categories in Shopify? I've found apps that claim to do it, but I believe it should be able I can do without an app.

Thanks

2

There are 2 best solutions below

0
On

You need to know which template to target, usually templates that have pagination in Shopify are: collection, blog, search.

So you should be able to do something like this in theme.liquid:

{% if template.name == "collection" or
  template.name == "blog"
%}
  <meta name="robots" content="noindex, nofollow" />
{% endif %}

This ^ is very generic so if you want to be more specific, you can check for the page object (collection, product, page, blog, article, etc...) handle:

{% if collection.handle == "example" or
  page.handle == "example" or
  blog.handle == "example"
%}
  <meta name="robots" content="noindex, nofollow" />
{% endif %}
0
On

It would be better to let Google crawl pagination URLs, using a self referencing canonical for each. As soon as you add nofollow you block the bots. That can cause problems.