How to Edit Your Shopify Robots.txt File (You Can’t, But Here is How To Hide Pages)

As of 2021, you can not edit the robots.txt file of your Shopify store.

Shopify automatically creates and updates the robots.txt file for you. While this is handy, it might frustrate your efforts to fine-tune your website’s SEO.

BUT you can still hide pages and products on your Shopify store from Google and other search engines by adding a “noindex” tag to your page.

(don’t worry, I’ll explain what a noindex tag is and the easiest way to add one to your page).

Not only that but, but adding a noindex tag is the right way to hide your pages from Google.

Using just your robots.txt file, you can not guarantee that your pages will be hidden from Google.

Let me explain.

(but if you want to skip my explanation and just learn how to hide your Shopify pages from search engines, click here)

Shopify Robots Txt

Search engines (like Google) use robots called “crawlers” to discover pages on your Shopify store.

Getting “crawled” by one of these crawlers is essential to getting your Shopify store ranking in Google and other search engines (if they can’t find your page, they can’t rank it).

A robots.txt file (also known as a “robots exclusion standard”) tells search engine crawlers which pages the crawler can or can’t request from your online store.

You might think the robots.txt file can hide a page from Google searches, but, surprisingly, it doesn’t work that way.

The robots.txt file is mainly used to avoid overloading your site with requests; it is not a tool for keeping a web page out of Google (or other search engines).

This is because if another website links to your website directly, a search engine crawler can still follow that link and find your page.

In this case it won’t read your robots.txt file, and can hence rank your page in Google.

To hide a web page from Google, you need to add a special code called a noindex tag to your page.

(Or password-protect your page, although that would mean users can’t visit the page while browsing your site).

A noindex tag is piece of code that tells crawlers not to crawl your page. It looks something like this:

<meta name="robots" content="noindex" />

If we add this to a page or product on your Shopify store, it will be hidden from search engines (like Google, Bing, and Yahoo).

So even though you can’t edit the robots.txt file of your Shopify store, all hope is not lost.

You can still hide your pages from Google while allowing users to see the pages while navigating to them on your site (or if you link the user to the page directly).

So here’s to make sure search crawlers from Google, Bing, or Yahoo are blocked from crawling certain URLs on your e-commerce site.

How To Edit Your Shopify Robots.txt File

You cannot edit your Shopify Robots.txt file. However, there are other methods to control the URLs that any search engine will crawl by editing your theme code. This works for all online store themes. Simply add in a code snippet into your theme.liquid file that will instruct Shopify to noindex certain URLs.

How To Hide Shopify Pages From Search Engines

  1. Locate the theme.liquid file
  2. Identify the page handle of the page you want to hide
  3. Add in the code snippet

1. Locate The theme.liquid File

Here’s how to locate your theme.liquid file in Shopify. It is available for all online store themes.

  1. Log in to your site and go to the Shopify admin.
  2. Go to Online Store
  3. Go to Themes
  4. Choose your Shopify store theme
  5. Click Actions > Edit code
  6. Under the Layout folder, click on the theme.liquid layout file
Shopify Robots Txt Edit Code
Shopify Robots Txt Themeliquid

2. Identify The Page Handle Of The Page You Want To Hide

The page handle is an identifier in your page URL. For example, if the name of your product page is Amazing Tennis Balls, typically the page handle would be ‘amazing-tennis-balls’.

3. Add In The Code Snippet

Under the <head> tag in your theme.liquid layout file, you need to add a code snippet.

If you wanted to hide the Amazing Tennis Balls product pages for your Shopify store, paste in the following code:

{% if handle contains 'amazing-tennis-ball' %}
<meta name="robots" content="noindex">
{% endif %}

You can do this for any page handle you want. Simply replace ‘amazing-tennis-ball’ with the correct page handle. This code will hide a page with the URL containing the page handle from the search engines such as Google, Bing and Yahoo.

Click on the Save button to save your configuration.

How to Hide Multiple Pages From Search Engines

Unfortunately, there is no simple way of grouping all the pages you want to disallow search engines like Google and Bing from crawling. You’ll have to do the following.

  1. Make a list of all the pages you want to exclude from being indexed by Google, Yahoo, Bing and any other search engine.
  2. Convert the page names to page handles
  3. Edit the following code and insert it in the head section to disallow search engines from indexing the pages. Replace ‘page-handle-you-want-to-exclude’ and ‘another-page-handle-you-want-to-exclude” with the correct page handles.
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% elsif handle contains 'another-page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% else %}
<meta name="robots" content="index">
{% endif %}

4. Click the Save button to stop the pages from getting indexed in search results.

You might notice at this point that this process is highly manual. You have to add a new {% elsif handle contains ‘new-page-handle’ %} code in the <head> section any time you want to edit the Shopify robots.txt file.

This method is straightforward for small e-commerce sites but can become quite cumbersome for larger stores with many pages.

Fortunately, there are Shopify apps that make it much easier for you to insert and manage noindex tags. The Sitemap & NoIndex Manager by Orbis Labs for $4.99/month is one example.

How to Hide the Search Template Page

If you want to edit your robots.txt file to hide the search template page from Google or Bing search results, you will also have to do it through the theme.liquid file.

  1. Log in to your site and go to the Shopify admin.
  2. Go to Online Store
  3. Go to Themes
  4. Choose your Shopify store theme
  5. Click Actions > Edit code
  6. Under the Layout folder, click the theme.liquid layout file
  7. Include the following code in the <head> tag.
{% if template contains 'search' %}
<meta name="robots" content="noindex">
{% endif %}

8. Click the Save button. This will disallow search engines like Google from including your search template page in the SERPs.


Shopify SEO can be challenging to manage because you can’t edit many of your site files. This can make it more difficult to disallow crawlers and prevent indexing of a page from search engines such as Google, and you might get pages showing up in search results when you don’t want them to.

Fortunately, it’s still relatively easy to edit your theme code when hiding a page from search engines. If you have a large website, you may want to explore alternative solutions that enable you to manage noindex tags more easily.

If you’re looking for (free) tips to increase your Shopify conversion rate and rank higher on Google, you can follow me on Twitter 👉🏻 @bitofseo.

Please DM me if you have any questions about this Shopify article (or have some feedback to make it better 😄️).

About Jake Sacino

After working as an engineer and consultant for a bunch of big companies, Jake now works as a full-time SEO & software engineer.