How to Add noindex for specific page in Shopify store

给你一囗甜甜゛ 提交于 2020-01-17 01:41:08

问题


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


回答1:


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 %}



回答2:


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.



来源:https://stackoverflow.com/questions/53081910/how-to-add-noindex-for-specific-page-in-shopify-store

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!