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.
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, the shopping cart page 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. If you want to edit your robots.txt, then refer to Editing robots.txt.
You can hide pages that are not 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 code to noindex particular pages.
Steps:
Desktop
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
- Click the
theme.liquid
layout file. - To exclude the search template, paste the following code in the
<head>
section.
- To exclude a specific page, paste the following code in the
<head>
section.
- In the code that you pasted, replace
page-handle-you-want-to-exclude
with the correct page handle. - Click Save.
iPhone
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Manage themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
- Click the
theme.liquid
layout file. - To exclude the search template, paste the following code in the
<head>
section.
- To exclude a specific page, paste the following code in the
<head>
section.
- In the code that you pasted, replace
page-handle-you-want-to-exclude
with the correct page handle. - Click Save.
Android
- From the Shopify app, tap the … button.
- In the Sales channels section, tap Online Store.
- Tap Manage themes.
- Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code.
- Click the
theme.liquid
layout file. - To exclude the search template, paste the following code in the
<head>
section.
- To exclude a specific page, paste the following code in the
<head>
section.
- In the code that you pasted, replace
page-handle-you-want-to-exclude
with the correct page handle. - Click Save.