We use Google Analytics cookies to understand which pages and tools are useful and improve the site. Privacy policy.

SEO + GEO

What data-nosnippet hides from Google and AI features

By bumpit Editorial2026-07-264 min read

The data-nosnippet attribute can exclude selected text from Google snippets. Apply it to supported elements, keep it stable in rendered HTML, and preserve answer conditions.

Written for a publisher deciding whether interface text, volatile pricing, or a sensitive passage should be excluded from Google result snippets.

Key facts

  • Google supports `data-nosnippet` on `div`, `span`, and `section` elements.
  • Google advises keeping the attribute stable rather than adding or removing it from existing nodes through JavaScript.
  • Google Search preview controls also affect how content can appear in AI Overviews and AI Mode.

A useful rule: make each important claim understandable and verifiable without requiring the reader to reconstruct your meaning from the rest of the page.

What the attribute controls

`data-nosnippet` marks selected text that Google should not use in a search result snippet. It does not make the page private, remove the URL from the index, or act as a canonical instruction. Use it when a public passage should remain visible on the page but would mislead or expose unwanted context if extracted into a result. Common candidates include cookie banners, navigation instructions, volatile interface messages, and a price that lacks nearby conditions. Start with the smallest element that contains the unwanted text. Hiding a broad article section can remove the most relevant passage Google has for a query.

  • Write the exact passage and reason before adding the attribute.
  • Keep confidential data out of public HTML instead of relying on snippet controls.
  • Test the effect on the whole answer unit, including conditions and units.

Sources: 1

Use supported, valid HTML

Google documents support for the attribute on `div`, `span`, and `section`. It treats the attribute as boolean, so values such as `false` do not turn it off. Invalid or unclosed HTML can cause a much larger block of text to fall inside the controlled element than intended. Custom elements should wrap relevant text in a supported HTML element when preview control matters. Inspect the final rendered DOM rather than a JSX component or template fragment. A framework can move nodes, render conditionally, or leave a closing-tag bug that changes the effective boundary.

  • Use the bare `data-nosnippet` attribute on a valid supported element.
  • Validate closing tags and inspect the element boundary in production HTML.
  • Avoid placing the attribute on a custom element without a supported wrapper.

Sources: 1

Keep JavaScript from creating uncertain states

Google says rendering is not guaranteed and recommends against adding or removing `data-nosnippet` from existing nodes through JavaScript. The crawler may extract text before or after the mutation and receive different controls. Render the intended attribute with the node from the start, whether that happens on the server or when JavaScript first creates a new element. Do not toggle it based on hover, consent, or viewport state. If a passage changes frequently enough to require dynamic preview rules, reconsider whether the volatile data belongs in an indexable answer at all.

  • Include the attribute in server output for static public passages.
  • When creating a new node client-side, add the attribute at creation rather than in a later effect.
  • Test raw and rendered HTML for the same control boundary.

Sources: 1

Understand the effect on Google AI Search

Google explains that Search preview controls govern information shown from pages in AI features. `nosnippet`, `data-nosnippet`, `max-snippet`, and `noindex` can therefore affect AI Overviews and AI Mode as well as classic results. These controls do not create separate permissions for ranking, grounding, training, and every external answer engine. Googlebot remains the crawler control for Google Search. If the business goal is to appear as a supporting link, preserve an accurate quotable passage outside the excluded element. Removing every direct answer may reduce what Google can preview even while the URL remains indexed.

  • Separate Google Search preview controls from controls for other Google systems.
  • Keep one visible sourced answer unit available when Search visibility remains desired.
  • Do not assume another answer engine implements Google's HTML attribute.

Sources: 1, 2

Verify the practical result

Deploy the attribute, fetch the final DOM, and confirm the boundary contains only the intended text. Use URL Inspection to check what Google received and allow time for recrawling. Then review representative result snippets and AI Search appearances where available. Exact snippet generation can vary by query, so absence of the text in one result does not prove a permanent global effect. Keep a dated record of the controlled passage and why it was excluded. Recheck after template changes because a component refactor can remove the attribute or expand its boundary without changing the article data.

  • Add a regression test for the attribute on the exact rendered element.
  • Review page-level `nosnippet` and `max-snippet` directives for conflicts.
  • Remove the control when the source passage becomes accurate and useful as a snippet.

Sources: 1, 2

Put it to work

Find the highest-impact fix on your site.

Inspect robots directives, data-nosnippet boundaries, rendered HTML, and the answer passages still available to Search.

Audit snippet controls

Sources

  1. 1.Google Search Central: Robots meta tag specificationsChecked 2026-07-26
  2. 2.Google Search Central: AI features and your websiteChecked 2026-07-26
Published 2026-07-26 · Last reviewed 2026-07-26 · Review due 2026-10-26Search systems and content quality