The Shopify-provided snippets, verbatim
Shopify's Hiding-a-page-from-search-engines doc provides two verbatim Liquid snippets for theme.liquid: a template-based condition that hides every page rendered by a given template type, and a handle-based condition that hides a specific resource by handle. Both inject the standard <meta name='robots' content='noindex'> tag conditionally. Both paste into the <head> of theme.liquid in the theme code editor.
Template-based conditions
Shopify's template-based snippet checks whether the current page's template name contains a target string. The most common use is to noindex every page rendered by the 'search' template — the internal-search results pages. Other template names worth knowing: 'cart', 'gift_card', 'customers/account', '404'. Shopify already sends an X-Robots-Tag: noindex, nofollow header on search result pages (/search?q=), so the tag is a second copy of the same instruction. Both only work if robots.txt lets Google fetch the page: a store with a robots.txt.liquid still prints Disallow: /search through Shopify's default loop, and Google never reads a noindex on a page it's blocked from crawling.
Handle-based conditions
The handle-based snippet checks whether the current page's handle contains a target string. Handles are URL-friendly identifiers: /pages/about-us has handle 'about-us', /products/linen-roman-shade has handle 'linen-roman-shade'. The condition is most useful for one-off pages with a stable, known handle — landing pages with their own URL but no search-indexing role, private launch destinations, internal-team microsites.
Where to paste in theme.liquid
Open Online Store > Themes > Actions > Edit code. In the file tree, open Layout > theme.liquid. The file's <head> section is at the top. Paste the snippet inside <head>, ideally above any other meta tags. The exact line doesn't matter as long as it's between <head> and </head> — but paste high in the head to ensure crawlers reading the first few hundred bytes encounter it early.
Verifying the noindex is live
Three verification methods, in order of reliability. (1) View source on the target page and search for 'noindex' — the meta tag should appear in the <head>. (2) Run curl https://yourstore.com/that-page | grep -i noindex from a terminal. (3) Use Google Search Console > URL Inspection on the target URL; the report should show 'Indexing allowed: No' with reason 'noindex' detected.