In short. Edit templates/robots.txt.liquid in Shopify's theme code editor, use Liquid default rule groups, and compare the rendered output before publishing.
Definition: As of October 2026, Shopify supports editing robots.txt through a theme file named
robots.txt.liquidin thetemplatesdirectory. This template renders the crawl rules served at/robots.txt; adding it replaces Shopify's automatically generated output.
Key facts
- Shopify's Help Center instructs merchants to save changes in the published theme.
- The template reference requires a Liquid file; a JSON template is unsupported.
- Shopify's customization guide recommends saving the current robots.txt output and comparing it with the rendered template before publishing.
How is the template created?
The Shopify Help Center procedure starts in Online Store. For the relevant theme, the actions menu provides Edit code. The documented template workflow is Add a new template, select robots, then Create template. An existing robots.txt.liquid file can be edited directly.
Shopify's developer instructions also describe file creation through the code editor: right-click Templates, choose New File, name it robots.txt.liquid, and press Enter. The resulting theme path is:
templates/robots.txt.liquid
Before editing, the Help Center instructs merchants to remove previous customizations or workarounds, including a third-party service used to serve robots.txt.
What goes inside robots.txt.liquid?
A user agent identifies the crawler to which a rule group applies. Shopify's customization guide shows how to iterate through the default groups, output their existing rules, and add a directive inside the relevant group. Its example adds a crawl restriction for URLs containing the ?q= parameter:
{% for group in robots.default_groups %}
{{- group.user_agent }}
{%- for rule in group.rules -%}
{{ rule }}
{%- endfor -%}
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /*?q=*' }}
{%- endif -%}
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{% endfor %}
This is Shopify's specific parameter-blocking example. The group.user_agent.value condition places the added directive in the wildcard group. The loop also outputs each group's sitemap when present. The same guide places additional crawler groups outside the loop when they are absent from the default set.
Shopify's template reference recommends using Liquid objects wherever possible. It also states that output from the default groups can differ from Shopify's generated file, making comparison necessary even when the template retains those groups.
How are changes checked and applied?
Shopify's developer guide calls for comparing the saved /robots.txt response with the rendered template before publication. That comparison identifies changes introduced by the template as well as the intended custom directive.
The Help Center locates robots.txt at the root of the store's primary domain, for example example.com/robots.txt. Changes saved in the published theme take effect instantly, although crawler reactions can lag behind.
Related terms
- robots.txt
- How do I retain Shopify's default robots.txt rules when editing?
- How do I restore Shopify's default robots.txt file?
- Does robots.txt Disallow prevent a URL from being indexed?
FAQ
Can I restore the automatically generated file?
Yes. Shopify's Help Center says you can delete the custom robots.txt.liquid file to return to its default robots.txt file.
Can I replace the template with plain text rules?
The template reference permits plain text rules but strongly recommends Liquid objects. The Help Center warns that replacing the template contents with plain text can leave rules outdated as Shopify changes its defaults.
Does Shopify Support edit this file?
The same Help Center documentation classifies these edits as an unsupported customization. If you need assistance, it directs you to a Shopify Partner.
Sources
- Shopify Help Center, "Editing robots.txt.liquid", undated
- Shopify, "Customize robots.txt", undated
- Shopify, "robots.txt.liquid", undated
Check how a page reads to answer engines. Open the GEO score analyzer