You need one additional rule on a Shopify store. In the live file, the checkout rule, named crawler groups and Sitemap lines should still appear. Start by saving the current response from the storefront’s root robots file.
Generate rules from the Shopify object
Shopify provides a generated robots file by default. Adding templates/robots.txt.liquid makes its rendered output the robots file. Shopify exposes robots.default_groups for the rule groups. Their output may differ from the generated file, so save the actual response for comparison.
This example retains the group headers, rules and available Sitemap lines, then adds an exact-path rule to the wildcard group. The example uses a fictional lookbook preview. The trailing $ limits this rule to that exact URL path without a trailing slash or query string.
{% for group in robots.default_groups -%}
{{ group.user_agent | strip }}
{% for rule in group.rules -%}
{{ rule | strip }}
{% endfor -%}
{% if group.user_agent.value == '*' -%}
Disallow: /pages/lookbook-preview$
{% endif -%}
{% if group.sitemap != blank -%}
{{ group.sitemap | strip }}
{% endif %}
{% endfor %}
Compare the rendered response with the saved file
We ran this Liquid with two example groups. The wildcard section gained one line and kept its original rules and Sitemap. The named test section stayed the same. The test used mock data and the open-source Liquid parser.
- Capture the status and response body at the actual storefront host’s
/robots.txt. Keep one copy for each affected market host. - In the target theme, use Online Store → Themes → Edit code and inspect the template under Templates. Compare the rendered theme output with the saved response before publishing. Investigate any missing or altered directives beyond your intended change.
- After publishing, request the storefront’s robots file again. Confirm it returns the intended plain-text rules, the new line under the right group and the expected Sitemap URL. If a response differs, use the robots HTTP status guide to check which file the host is serving.
Check a product URL and a collection URL under the intended bot’s group before approving the change. The robots rules guide explains how crawlers select groups and rules.
Frequently asked questions
Where does the Shopify template go?
Save it in Templates as robots.txt.liquid in the theme. Read the rendered file at the storefront’s root robots URL.
Does the wildcard rule cover a bot with its own group?
Google crawlers use their most specific matching group. If the crawler has a specific group, the wildcard group does not add rules to it.
Does the rule hide a page from visitors?
It governs crawling by robots that honor the file. Use access controls for content that should stay private.

