Platform Guides • 3 min read

Editing Shopify Robots.txt.liquid

Learn how Shopify renders robots.txt dynamically via robots.txt.liquid, how to add custom allow/disallow rules, and avoid common liquid syntax traps.

By SEO Free Editorial Team
Published: October 11, 2026
Shopify theme code editor showing robots.txt.liquid template and rule injection

Shopify’s Shift to Customizable Robots.txt

For many years, Shopify strictly locked down the robots.txt file. Store owners had zero ability to modify directives, remove legacy blocks, or customize rules for emerging search crawlers. In 2021, Shopify revolutionized this architecture by introducing the robots.txt.liquid template.

Today, Shopify merchants can customize crawler rules directly within their theme code while preserving Shopify’s core platform safeguards (such as checkout and cart protection).

How to Access and Create Robots.txt.liquid in Shopify

  1. Log in to your Shopify Admin.
  2. Navigate to Online Store → Themes.
  3. Click the three dots (...) next to your live theme and select Edit code.
  4. In the left-hand sidebar, under the Templates folder, click Add a new template.
  5. Select robots.txt from the dropdown menu and click Done.

Shopify will generate a default robots.txt.liquid file containing Shopify’s standard liquid loops and variables.

Understanding Shopify’s Liquid Loop Structure

Unlike a static text file, Shopify uses Liquid objects to generate rules dynamically:

{% for group in robots.default_groups %}
  {{- group.user_agent -}}

  {% for rule in group.rules %}
    {{- rule -}}
  {% endfor %}

  {%- if group.sitemap != blank -%}
    {{ group.sitemap }}
  {%- endif -%}
{% endfor %}

This template loops through Shopify’s default rules (which block /cart, /checkout, /orders, and internal search paths) and injects your store’s primary XML sitemap.

How to Add Custom Rules in Shopify

To inject custom rules without disrupting default security directives, add conditions inside the liquid template:

Example 1: Blocking AI Crawlers (e.g., GPTBot, ClaudeBot)

# Append to the bottom of templates/robots.txt.liquid
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

Example 2: Allowing Specific Collection Paths

If you want to modify rules for the generic * user-agent, add custom directives within the loop:

{% for group in robots.default_groups %}
  {{- group.user_agent -}}

  {% for rule in group.rules %}
    {{- rule -}}
  {% endfor %}

  {% if group.user_agent.value == "*" %}
    {{ "Disallow: /collections/*?*sort_by=" }}
    {{ "Allow: /collections/seasonal-sale" }}
  {% endif %}

  {%- if group.sitemap != blank -%}
    {{ group.sitemap }}
  {%- endif -%}
{% endfor %}

Critical Precautions for Shopify Stores

  • Never Remove Checkout Protections: Do not remove default Disallow rules for /checkout or /cart. Crawlers attempting to request session-based checkout paths will waste server resources and trigger security alerts.
  • Validate Live Output: Liquid template errors can cause Shopify to revert to default rules or fail rendering. Always verify your live output at https://yourstore.com/robots.txt using our Bulk Robots.txt Tester.

Frequently Asked Questions

Can I upload a static robots.txt file to Shopify?

No. Shopify does not provide root filesystem access via FTP. Customization is supported exclusively through the robots.txt.liquid theme template.

Does Shopify allow multiple sitemaps in robots.txt?

Shopify automatically generates and includes its own sitemap index (/sitemap.xml). You can append additional custom sitemaps in the liquid template if needed.

What happens if I make a syntax error in robots.txt.liquid?

Shopify’s Liquid parser will catch syntax errors. If rendering fails completely, Shopify serves its hardcoded fallback robots.txt to prevent accidental site-wide blocks.

Validate Your Robots.txt Directives in Bulk

Test up to 100 paths simultaneously against your live or draft rules using our RFC 9309 compliant evaluation engine.

Open Bulk Robots.txt Tester

Related Technical Guides