Post

Set no-index on shopify products pages and collections

If you want to reserve your Google Crawl budget to your most relevant pages than you wanted to de-index, the irrelevant pages from the Google Crawl.

We can set a no-index value on product, pages and collections in Shopify by adding a no-index meta tag to each of the specific pages. In order to target the specific pages will use a conditional if statement and added to our themes header.

Add no-index code to specific products and collections

In the layout/theme.liquid add your conditional code within the <head> tags

1
2
3
4
5
6
  {% if
  product.handle == 'example-1' or ]
  collection.handle == 'candles' or
  page.url == '/pages/privacy' %}
    <meta name="robots" content="noindex" />
  {% endif %}

Where to get the product handles from

Product handles can be taken from their URLs of the products. For instance, when viewing a product on the front end, if the URL of the product is example.com/products/my-product. Then the product handle is my-product

Where to get the collection handles from

Collection handles can be taken from their URLs of the collections. For instance, when viewing a collection on the front end, if the URL of the collection is example.com/collections/my-collection. Then the collection handle is my-collection

This post is licensed under CC BY 4.0 by the author.