Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Just want to know the preferred/correct syntax for listing multiple URL's to the Disallow in rorbots.txt.liquid
Is this correct?
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /pages/sms-alerts' }}
{{ 'Disallow: /pages/sign-up' }}
{{ 'Disallow: /products/free-sample' }}
{%- endif -%}
Or is this better or even valid?
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /pages/sms-alerts,
/pages/sign-up',
/products/free-sample' }}
{%- endif -%}
Solved! Go to the solution
This is an accepted solution.
Thanks for the reply, that is what I'm asking. So comma separated not accepted.
I'll just use:
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /pages/sms-alerts' }}
{{ 'Disallow: /pages/sign-up' }}
{{ 'Disallow: /products/free-sample' }}
{%- endif -%}
When in doubt use the simplest crudest version.
https://shopify.dev/themes/seo/robots-txt
Or just simply check what the rendered output is and that it matches the expectation of the syntax used.
For part of your possible valid code it looks like there are missing apostrophes or your using some syntax. But note i've never seen that construct in liquid before, or comma seperated values in a robots.txt if that's the goal of the output.
{{ 'Disallow: /pages/sms-alerts,
/pages/sign-up',
/products/free-sample' }}
vs
{{ 'Disallow: /pages/sms-alerts,
/pages/sign-up,
/products/free-sample' }}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
Thanks for the reply, that is what I'm asking. So comma separated not accepted.
I'll just use:
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /pages/sms-alerts' }}
{{ 'Disallow: /pages/sign-up' }}
{{ 'Disallow: /products/free-sample' }}
{%- endif -%}
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025