Adding llms.txt to Shopify
Shopify does not let you write files to the domain root, which is exactly where this file has to live. Here are the routes that work, and the one that does not.
Last updated
Standard Shopify cannot serve a file at /llms.txt, so you need a workaround. The common one is a plain template behind a URL redirect; the only clean one is a proxy such as a Cloudflare Worker in front of the store.
Why is Shopify different?
On Shopify you cannot upload a file that serves at https://yourstore.com/llms.txt. Theme assets are served from cdn.shopify.com, and the Files section in the admin puts uploads on a CDN path too. Neither is the root. That rules out the simple approach and leaves three real options. It is also why a Shopify app cannot simply drop an llms.txt at your root: if you try an llms.txt app, check the address it actually serves the file from (see the FAQ below).
Option 1: a theme template with a redirect (most common)
Shopify lets you create alternate templates and URL redirects. Combined, they get close to the right behaviour.
- In your theme code editor, add a new template, for example
templates/page.llms-txt.liquid. - Strip it to output plain content with no theme wrapper:
templates/page.llms-txt.liquid
{% layout none %}# {{ shop.name }} > {{ shop.description }} ## Collections {% for collection in collections %}- [{{ collection.title }}]({{ shop.url }}{{ collection.url }}): {{ collection.description | strip_html | truncatewords: 22 }} {% endfor %} ## Policies - [Shipping]({{ shop.url }}/policies/shipping-policy): Shipping regions, costs and delivery times. - [Returns]({{ shop.url }}/policies/refund-policy): Return window and conditions. - Create a page in the admin, assign it that template, and note its URL, something like
/pages/llms-txt. - Under Online Store › Navigation › URL Redirects, redirect
/llms.txtto that page.
Be honest about the limitation: this serves a redirect, and the response will be text/html rather than text/plain. Some readers accept it, some do not. It is the best available on standard Shopify, not a perfect implementation.
Option 2: a reverse proxy in front of the store
If your domain runs through Cloudflare, a Worker can serve /llms.txt directly with the correct content type and pass everything else to Shopify. This is the only approach that gets you a genuine root-level plain-text file, and it is straightforward if Cloudflare is already in front of your domain.
Option 3: Shopify Hydrogen
On a Hydrogen storefront you control routing, so you can add a route that returns the file properly, the same pattern as the Next.js approach.
What should a store list?
The main discipline is resisting the catalogue. Do not list products; list collections, and let the descriptions carry the specifics.
llms.txt
# Fern & Fold > Independent stationery shop in Melbourne. Notebooks, fountain pens and > paper goods. Ships within Australia and New Zealand only. ## Shop - [Notebooks](https://example.com/collections/notebooks): 60 titles, A6 to A4, dot grid, lined and blank. AUD 12-45. - [Fountain pens](https://example.com/collections/pens): Entry-level to enthusiast, AUD 25-480. ## Help - [Shipping](https://example.com/policies/shipping-policy): Free over AUD 90, 2-5 business days domestic. - [Returns](https://example.com/policies/refund-policy): 30 days, unused, return postage paid on faulty goods.
Shipping regions, price ranges and return terms are what models most often get wrong about a store, so put them in descriptions rather than leaving them to be inferred. Policy pages are worth listing explicitly for the same reason.
Frequently asked questions
Can I just upload it in Settings › Files?
You can upload it, but it will be served from the Shopify CDN rather than your domain root, so it will not be found where readers look.
Does the redirect approach actually work?
Partly. The content is reachable, but it arrives through a redirect as text/html, and readers vary in how strict they are. A proxy is the only clean fix on standard Shopify.
Should I list every product?
No. A store with thousands of products should list collections. Product detail belongs on product pages and in your structured data.
What about apps that claim to add it?
Check what the app actually produces and where it serves it from. Several generate a file that lands on a CDN path, which does not solve the problem.