Hiding a page from search engines

Search engines like Google constantly crawl the internet in search of new data. When your site is being crawled, your store's robots.txt file blocks page content that might otherwise reduce the effectiveness of your SEO strategy by stealing PageRank.

By default, your store's robots.txt file tells bots, usually search engine indexing bots or "crawlers", which pages or files they should or shouldn't request to view from a website. For example, your shopping cart page (found at www.example.com/cart) is requested not to be viewed by search engines because it's unique to individual customers and it isn't useful to be indexed by a search engine. All Shopify stores have a preconfigured and optimized robots.txt.liquid template, so you don't need to make any changes to your robots.txt.liquid file unless you have a specific reason to do so. Learn more about editing robots.txt.liquid.

If you want to hide a specific page or product from a search engine while still having it active and published to the online store sales channel, then you can use metatags or a custom metafield to manually hide your content from searches.

Learn more about managing searchability in your online store.

Hide a page or product using metatags

You can hide pages that aren't included in your robots.txt.liquid file by customizing the <head> section of your store's theme.liquid layout file. You need to include some metatag code to stop the indexing of particular pages.

Using metatags means that your product or page is hidden from search engines, but is still visible to your storefront search.

Steps:

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme you want to edit, click the button to open the actions menu, and then click Edit code.

  3. In the layout folder, click the theme.liquid file.

  4. To exclude the search template, paste the following code on a blank line in the <head> section:

{% if template contains 'search' %}
<meta name="robots" content="noindex">
{% endif %}
  1. To exclude a specific page or product, paste the following code on a blank line in the <head> section:
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}

Be sure to replace the page-handle-you-want-to-exclude value with the correct page handle. For example, if you wanted to hide a product called "Exclusive Secret Product" with a handle of exclusive-secret-product, then the if-statement would read: if handle contains 'exclusive-secret-product'.

6. Click Save.

Hide a page or product using a custom metafield

You can add a custom metafield to a product, page, or blog post in your Shopify admin and set the value to 1 to hide the product, page, or blog post from searches and sitemaps.

Steps:

  1. From your Shopify admin, go to Settings > Custom data.

  2. Under Metafield definitions, select the eligible resource type (Products, Pages, or Blog posts) that you want to hide.

  3. Click or tap Add definition.

  4. Set the following fields:

    • Give the metafield a Name such as SEO Hidden.
    • Set Namespace and key to seo.hidden.
    • Optional: Give a brief description, such as "Hides the resource from search engines when value is 1".
  5. Configure the custom field values by doing the following actions:

    1. Click or tap ⊕ Select type and then select Integer.
    2. Select One value.
    3. In the Validations section, set the Maximum value to be 1.
  6. Click Save.

  7. In your Shopify admin, navigate to the product, page, or blog post that you want to hide from search engines.

  8. In the Metafields section, set the value of the SEO Hidden metafield to 1.

  9. Click Save.

To make the product, page, or blog post visible to searches again, delete the SEO Hidden metafield value, leaving it blank, and then save your changes.

Having Google recrawl your URLs after making a change

If you made changes or added a page to your site, and you want Google to recrawl your URLs, then you have two options:

For more information, refer to Ask Google to recrawl your URLs.

Can’t find the answers you’re looking for? We’re here to help.