Shopify logo
How-To Guide

How do I add schema and llms.txt to my Shopify site?

To add schema and llms.txt to my Shopify site, you work in the theme code, not in the admin pages. You add a structured data script with the structured_data filter, then create an llms.txt.liquid template that controls the llms.txt file.

Updated November 22, 2026

TL;DR

Use structured_data

Output product and article objects as schema.org JSON with one Liquid filter.

Add llms.txt.liquid

Create the template in the templates directory of your theme.

GrandRanker keeps pages ready

GrandRanker writes search-led articles for your store and keeps them consistent.

6 steps

Step-by-Step

  1. 1

    Open Edit code

    In the Shopify admin, go to Online Store. For the relevant theme, open the horizontal menu icon and select Edit code.

  2. 2

    Create llms.txt.liquid

    The llms.txt.liquid template is located in the templates directory of the theme. Add a new template there named llms.txt.liquid.

  3. 3

    Write the llms.txt content

    Write a short list of your store's key pages and what each one covers, as standard text or Markdown. Only the request object and the agents object are available here, so do not rely on other store objects.

  4. 4

    Check /llms.txt

    Open the llms.txt address in a browser. Without an llms.txt.liquid template, /llms.txt falls back to agents.md.liquid, then to the Shopify default, so compare the output with your file.

  5. 5

    Add the structured data script

    Open the theme file that renders a product. Add a script tag with type application/ld+json that outputs the product through the structured_data filter.

  6. 6

    Test the rendered page

    Open a product page, view the page source, and confirm one application/ld+json block holds the Product or ProductGroup output. Make sure the page does not carry a second Product block.

Where does the llms.txt file go in Shopify?

The llms.txt file is a template in your theme, not a page you create in the admin. The llms.txt.liquid template is located in the templates directory of the theme, and it controls the file served at /llms.txt.

The lookup order is llms.txt.liquid first, then agents.md.liquid, then the Shopify default, so llms.txt.liquid takes precedence over agents.md.liquid. A dedicated llms.txt.liquid changes only the /llms.txt address, not /agents.md or /llms-full.txt, so the other agent files keep their current output.

Only the request object and the agents object are available. Keep the template short, since a long file is harder to review after each theme update.

How do I add product schema with structured_data?

The structured_data filter converts an object into a schema.org structured data format. It works on product and article objects, and it returns text you can place inside a script tag with the type application/ld+json.

Product objects without variants are output as a schema.org Product. Products with one or more variants are output as a ProductGroup, and article objects are output as an Article. Place the script only in templates that render one of those objects.

Test on one product before you roll the change across templates. Confirm the output is valid text inside the script tag, and that no other tool on the page adds a second Product block, which can confuse search engines. Products with several variants are the best test, because they produce a ProductGroup rather than a flat Product.

Where do I put head code and the title tag?

The title tag is only included in one file of your Shopify theme: theme.liquid. The code is inside the head element in theme.liquid, so head metadata you add belongs in that file rather than in a page template.

Before you edit it, copy the current file so you can restore it. Save the change to your published theme, then reload two or three pages to confirm the title tags still render.

Keep a copy of the theme file before any edit, and note which line you changed. If the page breaks after a save, restore the copy and check the head element again before you publish. Save the change only after the page renders with no Liquid errors.

Sources

Frequently Asked Questions

Let GrandRanker Do This for You

Grandranker does this for you. GrandRanker writes search-led articles for your Shopify blog and keeps the pages consistent with each other.