Shopify robots.txt template

Shopify generates robots.txt for every store and its defaults already keep crawlers out of cart, checkout, account and admin pages. You can’t upload a plain file; to change it you add a robots.txt.liquid template to your theme.

The template

User-agent: *
Disallow: /*?q=*
Disallow: /collections/*+*

User-agent: GPTBot
Disallow: /

Sitemap: https://example.com/sitemap.xml

Replace example.com with your domain before publishing.

templates/robots.txt.liquid

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

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

  {%- if group.user_agent.value == '*' -%}
    {{ 'Disallow: /*?q=*' }}
    {{ 'Disallow: /collections/*+*' }}
  {%- endif -%}

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

User-agent: GPTBot
Disallow: /

Where the file lives on Shopify

  • Online Store → Themes → … → Edit code → Templates → Add a new template → robots.txt. Shopify creates robots.txt.liquid pre-filled with the default groups.
  • Keep the loop over robots.default_groups so you inherit Shopify’s defaults and any updates Shopify makes to them.
  • Shopify adds your store’s sitemap line automatically through group.sitemap.

Why these rules

  • Shopify treats robots.txt.liquid as an advanced customisation and its support team won’t fix mistakes in it. Validate the rendered /robots.txt after every edit.
  • Filtered collection URLs with "+" (tag combinations) and internal search (?q=) create near-endless URL variations; they are common additions.
  • Removing the template restores Shopify’s default file.

After publishing, fetch your live file in the validator to confirm Shopify serves what you expect.

Shopify robots.txt questions

Can I edit robots.txt on Shopify?

Yes, by adding a robots.txt.liquid template to your theme. You can’t upload a plain robots.txt file.

What does Shopify’s default robots.txt block?

Checkout, cart, account, admin and several parameter and internal-search URLs. Open yourstore.com/robots.txt and paste it into the validator to see the current list.

How do I block AI crawlers on Shopify?

Add groups after the default loop in robots.txt.liquid, for example "User-agent: GPTBot" followed by "Disallow: /". The AI crawler page lists each vendor’s documented token.

Other platforms