Technical SEO
How to control crawling, indexing and snippets
Robots.txt controls crawling, noindex controls indexing and canonicals consolidate duplicates. Learn what each one does and when to use which.
Crawling and indexing are different
Use robots.txt to control what crawlers fetch, noindex to control what appears in search results, a canonical tag to say which duplicate URL should represent a group, and snippet rules to limit the text shown. Most mistakes come from using one of these to do another's job.
Crawling is a bot fetching a URL. Indexing is a search engine storing what it found and making the page eligible to appear in results. A page can be crawled and not indexed and, less obviously, a URL can be indexed without being crawled.
What robots.txt controls
The robots.txt file at the root of your host tells compliant crawlers which paths not to fetch. Its format is standardized in RFC 9309. Use it to keep crawlers out of areas with no search value, such as internal search results, endless filter combinations and admin paths.
User-agent: *
Disallow: /search
Disallow: /cart/
Sitemap: https://www.example.com/sitemap.xmlBlocking a URL does not remove it from the index. If other pages link to it, Google can still index the URL without its content, usually with no description. robots.txt is not a security control either: the file is public and obeying it is voluntary. AI crawlers such as GPTBot, ClaudeBot and PerplexityBot document that they follow robots.txt, though fetches made in real time on a user's behalf may be handled differently.
What noindex controls
A noindex rule tells search engines not to show a page in results. Put it in a meta robots tag in the HTML, or send it as an X-Robots-Tag HTTP header, which also works for PDFs and other non-HTML files.
<meta name="robots" content="noindex">
X-Robots-Tag: noindexThe page must stay crawlable for this to work. A crawler only sees the noindex when it fetches the page, so if robots.txt blocks the URL, the rule is never read and the page can stay indexed. Removal also waits for the next crawl. For something urgent, the Removals tool in Search Console hides a URL from Google results for about six months while the noindex takes effect.
Controlling snippets
- nosnippet
- A robots rule that stops Google from showing a text snippet or video preview for the page.
- max-snippet:[number]
- A robots rule that limits the text snippet to that many characters.
- data-nosnippet
- An HTML attribute for span, div and section elements that keeps that part of the page out of snippets.
<meta name="robots" content="max-snippet:160">
<p>Member price: <span data-nosnippet>log in to see</span></p>Google says these preview controls also limit how your content is shown in its AI features, such as AI Overviews. Use them with care, because a result with little or no snippet gives searchers less to go on.
Which to use when
- Keep a page out of search results
- noindex, with the page left crawlable.
- Several URLs show the same content
- A canonical tag, or a 301 redirect if the duplicate URL does not need to exist.
- Stop crawlers wasting requests on endless URL variations
- A Disallow rule in robots.txt.
- A page has been removed for good
- Return a 404 or 410 status.
- Limit the text shown in results and AI features
- nosnippet, max-snippet or data-nosnippet.
- Keep private content private
- Password protection or a login, not robots.txt or noindex.
Never block a page in robots.txt that you want noindexed. If an indexed URL has to go, add noindex, wait until it has dropped out of results, and only then block crawling if you still need to.
Put it to work
- AI crawler access and llms.txtAI engines can only cite pages they are allowed to read. Here is what Nalza checks and fixes.
- Free auditCheck your homepage in about a minute and see a preliminary score with your top issues.
- MovesDrafted fixes with a projected score impact. You approve, the connector applies.
More in Technical SEO
- What are Core Web Vitals?Core Web Vitals measure loading, responsiveness and visual stability. Learn the LCP, INP and CLS thresholds, how they are measured and how to fix them.
- What is structured data and schema markup?Structured data describes a page's content in a format machines can read. Learn JSON-LD, the common schema types, rich results and how to test markup.
- What is a canonical tag?A canonical tag tells search engines which URL is the main version of duplicate pages. Learn how it works, how to set it and which mistakes to avoid.
- What is an XML sitemap and what goes in it?An XML sitemap lists the URLs you want search engines to find. Learn what to include, how lastmod is used, the size limits and how to submit one.
- Can crawlers see content rendered by JavaScript?Googlebot renders JavaScript, but many AI crawlers appear to read only the raw HTML. Learn how rendering works and how to keep key content visible to both.
- Which redirect should you use: 301, 302, 307 or 308?Permanent and temporary redirects send different signals. Learn when to use 301, 302, 307 and 308, and how to avoid chains, loops and migration mistakes.
- How to write title tags and meta descriptionsTitles and meta descriptions shape how a page appears in search results. Learn how to write them, why Google rewrites them and how long they should be.