Sub topic 10
Meta robots tags and X-Robots-Tag headers
Assume you understand HTTP responses, basic HTML, and how a web crawler requests a page. You should also know that a crawler can fetch a resource even when a search engine later chooses not to index it.
Meta robots tags and X-Robots-Tag headers communicate instructions about how a compliant crawler should handle a resource. They are mainly indexing and presentation controls. They are not authentication and do not prevent a request from reaching your server.
Meta robots tags
A meta robots tag is an HTML element in the page's <head> section:
<!doctype html>
<html lang="en">
<head>
<meta name="robots" content="noindex, nofollow, noarchive">
<title>Private product notes</title>
</head>
<body>
<h1>Private product notes</h1>
<p>This page should not appear in a search index.</p>
</body>
</html>The name value identifies the crawler group. robots is the general token. Some search engines support their own token, such as googlebot, for a crawler-specific rule.
Common directives include:
| Directive | Meaning |
|---|---|
| `noindex` | Do not include the page in the search index |
| `nofollow` | Do not use links on the page for crawling or ranking signals |
| `noarchive` | Do not show a cached copy |
| `nosnippet` | Do not show a text snippet or preview |
| `max-snippet: N` | Limit the text snippet to approximately `N` characters |
A directive only works if the crawler can fetch the page and read the HTML. Therefore, a page blocked by robots.txt might never expose its meta tag to the crawler. Use robots.txt to express crawl preferences and meta directives to express indexing or display preferences after retrieval.
X-Robots-Tag response headers
X-Robots-Tag carries similar instructions in an HTTP response header:
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex, noarchive
Content-Length: 48219This works for HTML and for resources without an HTML <head>, such as PDFs, images, and downloadable documents. You can also target a particular crawler:
X-Robots-Tag: googlebot: noindex
X-Robots-Tag: noindexThe first rule targets the named crawler. The second provides a general rule. Exact support varies by crawler, so verify the documentation for the service you care about.
A server can emit the header conditionally. For example, an application might add noindex to preview environments, customer-specific documents, or expired content. Test the actual response with a tool such as curl:
curl -I https://example.com/manual.pdfLook for the returned X-Robots-Tag header, not only for a rule in the server configuration.
Relationship to AI crawlers
Meta robots tags and X-Robots-Tag headers do not automatically create a universal AI-training policy. AI services may use separate crawler identities, search systems, or usage-preference standards. A site owner should document which crawler is being addressed and confirm that the service recognizes the directive.
For a hard block, require authentication or enforce a server-side rule at a proxy, firewall, or web application firewall. For a preference about indexing or previews, use the robots directives and confirm behavior in logs and the service's documentation.
Exercise
You need to prevent a PDF from appearing in a compliant search index. Which mechanism can express this directly on the PDF response, and why is a meta tag insufficient?
Show answer
Use X-Robots-Tag: noindex. A PDF normally has no HTML <head> in which to place a meta robots tag.