In short. Retain the robots.default_groups loop, add directives to the intended groups, and compare the rendered template with Shopify's generated robots.txt.
Definition: Retaining Shopify's default rule groups means keeping the
robots.default_groupsloop inrobots.txt.liquidand adding custom directives around its output. Each group retains its user agent, existing rules and optional sitemap.
Key facts
- As of 17 October 2026, Shopify's editing documentation recommends Liquid customizations to preserve its ability to update rules automatically.
- Shopify's template reference states that adding
robots.txt.liquidreplaces the generated/robots.txtoutput. - Shopify's customization guide places additions to existing groups inside the default loop and separate custom groups outside it.
How does the default loop work?
Shopify's template reference places the file at templates/robots.txt.liquid. The outer loop visits each default group. It outputs group.user_agent, then each entry in group.rules, followed by group.sitemap when present. A user agent identifies the crawler to which a group applies.
Shopify’s addition example adapts that structure with a Disallow directive, which requests that a matching path remain uncrawled:
{% 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 %}
Where do custom directives belong?
Shopify's addition example supplies the /*?q=* pattern shown above. The condition selects the group whose user-agent value is *; the inner rule loop still prints every existing rule in that group. This example illustrates placement for a query-parameter restriction.
For a crawler absent from the default groups, the same guide shows a separate group after the default loop. Its example uses discobot. Appending these lines after the complete Liquid block retains the loop's output:
User-agent: discobot
Disallow: /
What needs checking before publication?
Shopify's template reference instructs merchants to save the current /robots.txt output and compare it with the rendered template before publication. The default groups available to Liquid can differ from Shopify's generated file.
Shopify's Help Center identifies a concrete difference: templates outputting default groups can retain Disallow: /search and Disallow: /policies/ after those rules disappear from the generated default. Reviewing these paths makes the comparison specific. Deleting the custom template restores the current generated file.
Related terms
- robots.txt
- robots.txt group precedence
- How do I edit robots.txt in Shopify?
- How do I restore Shopify's default robots.txt file?
FAQ
Can I replace the Liquid loop with plain text?
You can, but Shopify's editing documentation advises against it because the rules can become outdated. Keeping the Liquid objects preserves Shopify's ability to update the file.
Does saving the template make crawlers react immediately?
The same Shopify documentation says changes take effect instantly, while crawlers can respond later. You can inspect the published output at your primary domain's /robots.txt path.
Sources
- Shopify Help Center, "Editing robots.txt.liquid", undated
- Shopify Developers, "robots.txt.liquid", undated
- Shopify Developers, "Customize robots.txt", undated
Check how a page reads to answer engines. Open the GEO score analyzer