In short
nosnippet, max-snippet and data-nosnippet limit what Google and Bing can reuse from a page in their results. Their reach no longer stops at classic snippets: at Google, they also limit what can serve as direct input to AI Overviews and AI Mode; at Bing, they also apply to Copilot answers. This check consists of making sure none of these directives has been set by mistake on your strategic pages, and of using them in a targeted way where a restriction is genuinely intended.
Why it matters
These three controls act on display, not on indexing: the page stays in the index and can rank, but the search engine is limited in what it shows of it.
| Directive | Where | Documented effect |
|---|---|---|
nosnippet |
Robots meta tag or X-Robots-Tag header |
No text snippet or video preview. At Google, the content is not used as direct input to AI Overviews and AI Mode either. |
max-snippet:N |
Robots meta tag or X-Robots-Tag header |
Snippet limited to N characters. 0 is equivalent to nosnippet, -1 lets the search engine choose. At Google, it also limits the amount of content usable as direct input to AI features. |
data-nosnippet |
HTML attribute on span, div or section |
The marked passage is excluded from snippets; the rest of the page is not affected. Supported by Google, and by Bing for its results and for Copilot. |
Two situations cause problems.
The accidental restriction. A nosnippet inherited from an old setting, a max-snippet:0 set by a plugin, an X-Robots-Tag header applied to the whole site from the server: the page stays indexed, but it is displayed without a description and falls outside the scope of Google's generative answers. The symptom is subtle, so it is rarely diagnosed.
The missing restriction. A passage you do not want reused (promo code, subscriber-only content, legal notice, volatile review) is quoted as is in a snippet. data-nosnippet solves this without penalizing the rest of the page.
These directives only concern the search engines that document them. OpenAI, Anthropic and Perplexity do not mention them in their crawler documentation: for them, control goes through robots.txt. And a directive is only read if the page can be crawled: a URL blocked by robots.txt passes on no meta tag.
What it improves
- Click-through rate Removing an accidental
nosnippetgives the page back its description in the results. - Presence in Google and Bing AI answers A page without snippet restrictions remains eligible for AI Overviews, AI Mode and Copilot answers. Eligible does not mean selected: no practice guarantees a citation.
- Rich results Google's featured snippets require a sufficiently long snippet; a
max-snippetthat is too low excludes them. - Control over sensitive content
data-nosnippetkeeps a specific passage out without affecting indexing. - Rankings No direct effect. These directives control display, not position.
How to check
1. The page's meta tags:
curl -s https://example.com/page | grep -i -o -E '<meta[^>]+(robots|googlebot|bingbot)[^>]*>'
2. HTTP header, to be tested on a PDF and an image as well:
curl -s -o /dev/null -D - https://example.com/page | grep -i "x-robots-tag"
3. Marked passages:
curl -s https://example.com/page | grep -o -i "data-nosnippet" | wc -l
Compliant result for a page you want fully visible: no nosnippet, no low max-snippet, no restrictive X-Robots-Tag header. A value such as max-snippet:-1, max-image-preview:large, max-video-preview:-1 is the most open.
4. Site-wide: a crawler (Screaming Frog SEO Spider, for example) lists the meta robots and X-Robots-Tag directives for each URL; filter on nosnippet and max-snippet.
5. In the search engines' tools: the URL Inspection tool in Google Search Console shows the rendered HTML, useful if the tag is injected with JavaScript. In the results, an indexed page displayed without a description is a clue.
Good to know: when several directives contradict each other (meta tag, header, crawler-specific tag), the search engine applies the most restrictive one. A single
nosnippetforgotten in a header overrides everything else.
How to implement
Before you start
Decide page by page, using this table:
| Situation | Setting |
|---|---|
| Content page or commercial page to make visible | No restriction, or max-snippet:-1, max-image-preview:large |
| Visible page, with one passage not to be reused | data-nosnippet on that passage |
| Content whose reuse you want to limit (licensing agreement, press) | max-snippet:N with a chosen value |
| Page to index but with no snippet at all | nosnippet, accepting the loss of visibility |
| Page not to be indexed | noindex: that is a different topic, see check meta robots and X-Robots-Tag (opens in a new tab) |
HTML syntax, to place in the <head>:
<meta name="robots" content="max-snippet:160, max-image-preview:large">
Attribute syntax, valid only on span, div and section:
<p>
The subscription starts at €29 per month.
<span data-nosnippet>Subscriber-only code: MERCI10.</span>
</p>
<div data-nosnippet>
Members-only notices, not to be displayed in the results.
</div>
The attribute must be present in the HTML served. Google advises against adding it with JavaScript after loading.
For non-HTML files (PDFs, documents, images), only the X-Robots-Tag header works. The examples below set nosnippet on documents and a max-snippet on a directory: adapt the paths.
Apache
Versions Apache 2.4.
Enable mod_headers (sudo a2enmod headers), then in the virtual host configuration:
<FilesMatch "\.(pdf|docx?|xlsx?)$">
Header set X-Robots-Tag "nosnippet"
</FilesMatch>
<LocationMatch "^/conditions/">
Header set X-Robots-Tag "max-snippet:160"
</LocationMatch>
In a .htaccess file, only the <FilesMatch> block is allowed; for a directory, place a .htaccess file containing the Header set line in that directory. To find a header set by mistake:
grep -rni "x-robots-tag" /etc/apache2/ /var/www/example/.htaccess
sudo apachectl configtest && sudo systemctl reload apache2
Nginx
Versions Nginx 1.18 and later (including stable 1.30 and mainline 1.31).
In the server block:
location ~* \.(pdf|docx?|xlsx?)$ {
add_header X-Robots-Tag "nosnippet" always;
}
location /conditions/ {
add_header X-Robots-Tag "max-snippet:160" always;
try_files $uri $uri/ /index.php?$query_string;
}
By default, an add_header in a location block cancels those inherited from the server level: repeat your other headers there. Since Nginx 1.29.3 (including the 1.30 stable branch), add_header_inherit merge; placed at the http or server level keeps the inherited headers and adds the block's own. Search and reload:
grep -rni "x-robots-tag" /etc/nginx/
sudo nginx -t && sudo systemctl reload nginx
IIS
Versions IIS 10 (Windows Server 2016 to 2025); the syntax has been the same since IIS 7.
In the web.config file, for a directory:
<configuration>
<location path="documents">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Robots-Tag" value="nosnippet" />
</customHeaders>
</httpProtocol>
</system.webServer>
</location>
</configuration>
Caddy
Versions Caddy 2.6 and later.
example.com {
@documents path *.pdf *.docx *.xlsx
header @documents X-Robots-Tag "nosnippet"
root * /var/www/example
file_server
}
Reload with sudo systemctl reload caddy.
Cloudflare
Versions Cloudflare dashboard, all plans, November 2026.
Rules > Overview > Create rule > Response Header Transform Rule. Expression:
(http.request.uri.path.extension eq "pdf")
Action: Set static, name X-Robots-Tag, value nosnippet. Also check that no existing rule, and no Worker, adds this header to the whole site. Purge the cache after making changes.
AWS
Versions Amazon CloudFront console, November 2026.
CloudFront: in the CloudFront console, create a response headers policy (Policies > Response headers) with a custom X-Robots-Tag header, and attach it to the behavior whose path pattern matches (*.pdf, /documents/*). Then run an invalidation.
S3 does not let you add this header to objects: go through CloudFront.
Application Load Balancer: set the header in the web server or the application.
Plesk
Versions Plesk Obsidian 18.0.
Websites & Domains > example.com > Hosting & DNS > Apache & nginx: paste the Nginx block into “Additional nginx directives”, or the Apache block into “Additional directives for HTTPS”.
cPanel
Versions cPanel & WHM 110 and later.
Add the <FilesMatch> block from the Apache section to public_html/.htaccess, using the File Manager.
Shared hosting
Same method as cPanel: .htaccess at the root for files, meta tag in the template for pages. If mod_headers is unavailable, the header is ignored or causes a 500 error: wrap the block in <IfModule mod_headers.c>.
Vercel
Versions vercel.json file, all Vercel plans, November 2026.
In vercel.json:
{
"headers": [
{
"source": "/documents/(.*)",
"headers": [
{ "key": "X-Robots-Tag", "value": "nosnippet" }
]
}
]
}
Netlify
Versions _headers file, all Netlify plans, November 2026.
In the _headers file of the publish directory:
/documents/*
X-Robots-Tag: nosnippet
WordPress
Versions WordPress 5.7 and later (including 7.x, wp_robots filter); Yoast SEO and Rank Math plugins in their November 2026 versions.
WordPress itself adds max-image-preview:large to indexable pages. For the rest:
- Yoast SEO: in the editor, Yoast block,
Advancedtab, “Meta robots advanced” setting (“No Snippet”, “No Archive”, “No Image Index” options). - Rank Math:
Advancedtab of the Rank Math block, “No Snippet” checkbox and advanced settings (maximum snippet length, image and video preview). The defaults are inRank Math SEO > Titles & Meta(Global Meta, then per content type). - Without a plugin, through the
wp_robotsfilter in the child theme or a custom plugin:
add_filter('wp_robots', function (array $robots): array {
if (is_page('conditions-generales')) {
$robots['max-snippet'] = '160';
}
return $robots;
});
For data-nosnippet, use a “Custom HTML” block or add the attribute in the theme template. Audit the SEO plugin's global settings: that is where most accidental nosnippet directives hide.
Shopify
Versions Online Store 2.0 themes, all Shopify plans, November 2026.
In Online Store > Themes, click the … button of the current theme, then Edit code, file layout/theme.liquid, in the <head>:
{% if template.name == 'page' and page.handle == 'conditions-generales' %}
<meta name="robots" content="max-snippet:160">
{% endif %}
The data-nosnippet attribute is added in the theme's sections. HTTP headers cannot be modified on Shopify.
Drupal
Versions Drupal 10 and 11, Metatag module 2.x.
The Metatag module (Configuration > Search and metadata > Metatag) offers nosnippet, max-snippet, max-image-preview and max-video-preview in the robots tag's advanced settings, per content type or per page.
Wix
Versions Wix Editor and Wix Studio, all plans, November 2026.
The page's SEO settings, Advanced tab, “Robots meta tag” section: nosnippet checkbox and max-snippet, max-image-preview, max-video-preview settings.
Webflow
Versions Webflow Designer, site plans, November 2026.
Add the tag in Page settings > Custom code > Inside head tag, and the data-nosnippet attribute in the element's custom attributes. Squarespace works the same way through code injection, depending on the plan.
Laravel
Versions Laravel 10 to 13.
In the Blade template, provide a section that the relevant pages override:
<meta name="robots" content="@yield('robots', 'max-snippet:-1, max-image-preview:large')">
For a file served by the application:
return response()->file($path, [
'X-Robots-Tag' => 'nosnippet',
]);
Next.js
Versions Next.js 13.2 to 16 (App Router); Pages Router from Next.js 12 to 16.
The attribute is written <div data-nosnippet> in JSX, rendered on the server, whichever router you use.
App Router
The metadata object of a page.js or layout.js file generates the tag:
export const metadata = {
robots: {
index: true,
follow: true,
"max-snippet": 160,
"max-image-preview": "large",
},
};
For a total restriction, replace "max-snippet": 160 with nosnippet: true. A page's robots object entirely replaces the parent layout's: repeat all the directives you want in it.
Pages Router
In the relevant page, with the Head component:
import Head from "next/head";
export default function Conditions() {
return (
<>
<Head>
<meta name="robots" content="max-snippet:160, max-image-preview:large" />
</Head>
<main>{/* content */}</main>
</>
);
}
Nuxt
Versions Nuxt 4; identical on Nuxt 3, end of life since July 2026.
useSeoMeta({
robots: "max-snippet:160, max-image-preview:large",
});
Common mistakes
- Confusing
nosnippetandnoindex: the first hides the snippet, the second removes the page from the index. - Setting
nosnippetsite-wide “to protect yourself from AI”: you also lose your descriptions in classic results, with no documented effect on ChatGPT, Claude or Perplexity. - Putting
data-nosnippeton a<p>,<li>or<td>: onlyspan,divandsectionare taken into account. - Blocking the page in robots.txt and counting on the tag: the crawler does not read the page, so it does not read the directive.
- Choosing a very low
max-snippetwithout measuring: featured snippets and some rich displays disappear. - Forgetting the HTTP header: a global
X-Robots-Tag: nosnippet, set at the server or CDN level, overrides a permissive meta tag. - Injecting the directive with JavaScript: depending on when rendering happens, it may be read too late or not at all.
- Expecting an immediate effect: the change is only taken into account after the page is crawled again.
Frequently asked questions
Does the nosnippet tag prevent a page from appearing in AI Overviews?
Yes, at Google, the content of a page with nosnippet is not used as direct input to AI Overviews and AI Mode, and the page also loses its snippet in the results. It nevertheless stays indexed and can rank. To keep out a single passage, prefer the data-nosnippet attribute on that block: the rest of the page remains eligible for snippets and generative answers.
Does nosnippet protect my content from ChatGPT or Claude?
No, OpenAI, Anthropic and Perplexity do not mention nosnippet, max-snippet or data-nosnippet in their crawler documentation: these directives concern Google and Bing. Setting nosnippet site-wide “to protect yourself from AI” makes you lose your descriptions in classic results, with no documented effect on these assistants, which are controlled through robots.txt.
Which HTML elements does the data-nosnippet attribute work on?
The data-nosnippet attribute is only taken into account on span, div and section elements. Placed on a paragraph, a list item or a table cell, it is ignored. It must also be present in the HTML served: Google advises against adding it with JavaScript after loading. The marked passage stays indexed, but it is excluded from snippets.
What is the difference between nosnippet and noindex?
nosnippet hides the snippet: the page stays in the index and can rank, but the search engine shows no text from it and, at Google, does not use it as direct input to AI features. noindex removes the page from the index: it disappears from the results. Confusing the two costs you either the description or the entire page.
Resources
- Google: robots meta tag, data-nosnippet and X-Robots-Tagdevelopers.google.com
- Google: AI features and your websitedevelopers.google.com
- Google: featured snippetsdevelopers.google.com
- Bing: support for the data-nosnippet attributeblogs.bing.com
- Bing: options to control snippetsblogs.bing.com
- Bing Webmaster Toolsbing.com
- MDN: X-Robots-Tag headerdeveloper.mozilla.org
- WordPress: wp_robots filterdeveloper.wordpress.org
Updated on
Topic checklist (PDF)