Editing robots.txt.liquid

Search engines, such as Google, constantly crawl the internet in search of new data as a source for their search results. Therobots.txtfile tells search engine bots, known as crawlers, which pages to request to view from your online store. All Shopify stores have a defaultrobots.txtfile that's optimal for Search Engine Optimization (SEO).

Your sitemap is used by search engines to place your online store in the search engine results. Learn how tofind and submit your sitemap.

Overview

The defaultrobots.txtfile works for most stores, but you can edit the file through therobots.txt.liquid theme template. You can make the following edits:

  • allow or disallow certain URLs from being crawled
  • add crawl-delay rules for certain crawlers
  • add extra sitemap URLs
  • block certain crawlers

Therobots.txtfile is located at the root directory of your Shopify store'sprimary domain name. For example:johns-apparel.com/robots.txt.

Edit robots.txt.liquid

If you want to edit therobots.txt.liquidfile, then you should work with a Shopify Partner or have expertise in code edits and SEO.

You can use Liquid to add or remove directives from therobots.txt.liquidtemplate. This method preserves Shopify’s ability to keep the file updated automatically in the future, and is recommended. For a full guide on editing this file, refer to Shopify's Developer pageCustomize robots.txt.liquid.

Remove any previous customizations or workarounds, such as using a third-party service such as Cloudflare, before you edit therobots.txt.liquidfile.

Steps:

  1. From your Shopify admin, clickSettings>Apps and sales channels.

  2. From theApps and sales channelspage, click欧宝体育官网入口首页.

  3. ClickOpen sales channel.

  4. ClickThemes.

  5. Click the...button, and then clickEdit Code.

  6. ClickAdd a new template, and then selectrobots.

  7. ClickCreate template.

  8. Make the changes that you want to make to the default template. For more information on liquid variables and common use cases, refer to Shopify's Developer pageCustomize robots.txt.liquid.

  9. Save changes to the robots.txt.liquid file in your published theme.

Changes are instant, but crawlers don't always react immediately. You can test changes usingGoogle's robots.txt Tester.

您还可以删除模板的内容nd replace it with plain text rules. This method is strongly not recommended, as rules may become out of date. If you choose this method, then Shopify can’t ensure that SEO best practices are applied to your robots.txt over time, or make changes to the file with future updates.

Delete robots.txt.liquid customizations

If you want to use the defaultrobots.txtfile again, then save a copy of yourrobots.txt.liquidtemplate customizations as you need to delete the template, which can't be undone.

Steps:

  1. From your Shopify admin, clickSettings>Apps and sales channels.

  2. From theApps and sales channelspage, click欧宝体育官网入口首页.

  3. ClickOpen sales channel.

  4. ClickThemes.

  5. Click the...button, and then clickEdit Code.

  6. Clickrobots.liquid, and then clickDelete file.

  7. If you still want to delete robots.txt.liquid, then clickDelete file.

You can always edit therobots.txt.liquidfile in the future, or if you saved your past customizations, then you can redo your changes by copying over your saved previous customizations.

Ready to start selling with Shopify?Try it free