{%- comment -%}
  Shopify templates/robots.txt.liquid: keep Shopify's default rules and opt out of OpenAI model training only.
  Checked against shopify.dev "Customize robots.txt" (default-groups loop), RFC 9309 group matching and the OpenAI bots doc (GPTBot trains, OAI-SearchBot is ChatGPT search).
  Replace every placeholder. This is an unsupported customization: keep a copy of your current /robots.txt first.
{%- endcomment -%}
{% for group in robots.default_groups %}
  {{- group.user_agent }}
  {%- for rule in group.rules -%}
    {{ rule }}
  {%- endfor -%}
  {%- if group.sitemap != blank -%}
    {{ group.sitemap }}
  {%- endif -%}
{% endfor %}

User-agent: GPTBot
Disallow: /

{%- comment -%}
  To add a rule to the existing * group, put this inside the for-group loop, after the inner rules loop:
  {%- if group.user_agent.value == '*' -%}
    {{ 'Disallow: /*?q=*' }}
  {%- endif -%}
{%- endcomment -%}
