0
votes

I have a Shopify store and I want to block search engines to index some products pages, I found this solution https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines?utm_source=gurucopy&utm_medium=link&utm_campaign=Gurus#undefined

{% if handle contains 'page-handle-you-want-to-exclude' %} <meta name="robots" content="noindex"> {% endif %}

but I don't how I should make changes to block my pages below my page link mysite.com/products/product-26

mysite.com/products/kalita

Thank You

2

2 Answers

1
votes

There is very handy way for doing it.. It works like a charm.. You can make use of metafields property for products provided by Shopify (look for tool called ShopifyFD for Google Chrome)

Create a metafield for the product(s) you want to hide from Google. Have a metafield with namespace as "seo" and key as "robots" and give value as "noindex" or "noindex, nofollow" based on what you need and "Save"

Now in your theme.liquid in head section, add the following

{% if product and product.metafields.seo and product.metafields.seo.robots %}
  <meta name="robots" content="{{ product.metafields.seo.robots }}">
{% endif %}
0
votes

Shopify have an API guide for doing this: Hide a resource from search engines and sitemaps:

POST /admin/api/2019-10/products/#{id}/metafields.json
{
  "metafield": {
    "namespace": "seo",
    "key": "hidden",
    "value": 1,
    "value_type": "integer"
  }
}

You might also want to check out their Developer Tools app, if you are using macOS — that will allow you to perform the post request, after you have authenticated using private app creds.