Insights

How to Edit Shopify Robots.txt File?

Share on linkedin
Share on twitter
Share on facebook

Editing the Shopify Robots.Txt File: The How-to Guide

The Shopify robots.txt file enables you to give commands to search engine crawlers such as Google. These instructions will tell them what resources are most relevant to your search. The file will also tell web crawlers when not to crawl certain resources, such as login or admin pages. What’s more, users of Shopify can also change the instructions to get a more accurate and useful result. 

The Location of Shopify Robots

The robots.txt is found in the root folder of a user’s primary domain. Previously, it wasn’t possible to edit this file. As of June 16, 2021, however, this option is now available to Shopify users. Tobi Lutke, the CEO of Shopify, confirmed this fact by tweeting about it on the aforementioned date. 

Editing the Shopify Robots.txt File: A Step by Step Guide

If you’re interested in editing your Shopify robots.txt file, here are the steps you’ll need to follow: 

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Click ‘Actions’, then ‘Edit Code’
  3. Click the ‘Add a new template’ option
  4. Select ‘robots’
  5. Click ‘Create template’
  6. Make any edits or changes on the default template
  7. Save the changes to robots.txt.liquid file in the published theme

Before you follow these steps though, keep in mind that these kinds of customizations are unsupported. This means that Shopify support will not be able to help in troubleshooting any problems. 

Hiding Shopify Pages

If you want to hide your Shopify pages from Google, simply change the instructions regarding this. You can do this in the following way: 

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Find and select the theme you need to edit
  3. Click ‘Actions’, and then, click ‘Edit Code’
  4. Select the theme.liquid layout file

Hiding the Shopify Search Template

At some point, you might also want to hide the Shopify search template from search engines like Google. Follow the steps below to accomplish this: 

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Find and select whatever theme you need to edit. 
  3. Click ‘Actions’, then click ‘Edit code’
  4. Select the theme.liquid layout file
  5. Paste the code below within the section

shopify robots.txt code image

Hiding a Particular Shopify Page from Search Engines

If you’re looking to hide one specific page on Shopify from Google web crawlers, here’s how to go about it: 

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Select the theme for editing
  3. Click ‘Actions’, then click ‘Edit code’
  4. Select the theme.liquid layout file
  5. Paste the code below within the <head> section:   Hiding a Particular Shopify Page from Search Engines
  6. Ensure that you replace the words ‘page-handle-you-want-to-exclude’ with the right page handle that you want to hide
  7. Click ‘Save’

About Page Handles

The page handle in Shopify is the URL slug, which is the net of the domain. It’s basically the title of the object in lowercase letters. If there are any spaces in the titles, these are represented by hyphens. The same goes for any special characters such as a comma, semicolon, etc. 

The Shopify Developers page has more information about Object Handle documentation. So, you can also go there for further clarification. 

Hiding Multiple Pages from Search Engines

When you want several pages to stay hidden from search engine web crawlers, especially Google’s, here’s what you need to do:

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Select the theme for editing
  3. Click ‘Actions’, then click ‘Edit code’
  4. Select the theme.liquid layout file
  5. Paste the code below within the section:
  6. Replace ‘page-handle-you-want-to-exclude’ with the relevant page handles
  7. Save the changes

Hiding Dynamic Shopify Pages from Search Engines

If your aim is to hide dynamic Shopify pages from search engines, try these steps: 

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Select the theme for editing
  3. Click ‘Actions’, then click ‘Edit code’
  4. Select the theme.liquid layout file
  5. Paste the code below within the <head> section:
  6. Replace ‘your-text’ with the relevant keywords that you need to hide
  7. Save the changes

Disclaimer: Keep in mind that the methods we’ve discussed above do not involve editing the Shopify robots.txt. They’re aimed at adding a ‘robots’ meta tag to the pages. Even after you’ve made these edits, Google web crawlers might still crawl them. If you want to guide such pages from things like Googlebot, we’ll discuss the solution later on. This will also replace any need for editing Shopify robots.txt.

Protection from Web Crawlers: Hiding Shopify Pages

You should carry out the following steps for hiding Shopify pages from the web crawlers like Googlebot:

  1. Go to the Shopify admin page. From there, select Online Store>Themes
  2. Select the theme for editing
  3. Click ‘Actions’, then click ‘Edit code’
  4. Select the theme.liquid layout file
  5. Paste the code below within the <head>section:
  6. Remove ‘current_tags’ and use that space to put in the right tag for the pages that need hiding.
  7. Save your changes
logo-scroll-grey-1.png

As Lead SEO at Shout Digital, Nandeep Kandimalla is at the forefront to create an SEO strategy to improve organic site visibility and lead conversion.

With over 9+ years of experience in SEO and a Master’s degree in Information Systems (Security) from RMIT Melbourne, Nandeep provides creative SEO strategies based on analytical data of past & future trends.

Connect with him through LinkedIn or visit Shoutdigital.com.au for a 20 min SEO consultation on how to improve organic growth.

Up Next

Michael Jenkins Image

Michael Jenkins

Digital Strategist
Michael Jenkins Signature

What you will learn from the chat

    Guaranteed Sales Starts With Locking in a Phone Call

    image

    Michael Jenkins

    Digital Strategist
    image
    In just 30 minutes I can map out an X-Chart, a guaranteed sales forecast for your business. Yep, that's right.....it's guaranteed
    Register for call

    Ready to Grow Your Business?
    We are.

    image

    Michael Jenkins

    Digital Strategist
    image

    You’re registering a call for
    .

    iconBack

    You’re registered!

    We’ll see you on January 7 at 11am AEST

    A confirmation has been sent to your email address.

    Click here to access your copy of Growth Tips For The Post Covid Economy.

    What you will learn from the chat

    Michael Jenkins Picture

    Michael Jenkins

    Digital Strategist
    Michael Jenkins Signature