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.
If you made changes or added a page to your site, and you want Google to recrawl your URLs, then you have two options. You can either use the URL Inspection Tool, or submit a sitemap to Google. For more information, refer to Ask Google to recrawl your URLs.
The robots.txt
file is located at the root directory of your Shopify store's primary domain name. For example: johns-apparel.com/robots.txt
.
Although you can't edit the content of your store's robots.txt
file, you should be aware of the content that it blocks from search engines. For example, the shopping cart page is blocked from search engines because you want customers to find your product pages before the cart page.
You can hide pages that are not included in your robots.txt
file by customizing the <head>
section of your store's theme.liquid
layout file. You need to include some code to noindex particular pages.
Steps:
From your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, and then click Actions > Edit code.
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
Click the
theme.liquid
layout file.-
To exclude the search template, paste the following code in the
<head>
section:{% if template contains 'search' %} <meta name="robots" content="noindex"> {% endif %}
-
To exclude a specific page, paste the following code in the
<head>
section:{% if handle contains 'page-handle-you-want-to-exclude' %} <meta name="robots" content="noindex"> {% endif %}
Make sure that you replace
page-handle-you-want-to-exclude
with the correct page handle. Click Save.