Robots.txt

5-15 minIntermediate

Shopify generates a default robots.txt. Since 2021, you can customize it by creating a specific liquid template.

Prerequisites

  • Shopify Admin
Advanced

Customizing robots.txt.liquid

Creating the override file to add custom rules.

1

Create Template

1

Go to Online Store > Themes > Edit Code

2

Under "Templates", click "Add a new template"

3

Select "robots"

4

This creates robots.txt.liquid

2

Add Rules

1

You can now add Liquid logic or plain text directives

2

Example: {%- if group.user_agent.value == "*" -%} Disallow: /pages/hidden-contest {%- endif -%}

3

Use with caution

Verification Checklist

  • Visit yourstore.com/robots.txt
  • Verify your custom rules appear