What does Google say about SEO? /
Quick SEO Quiz

Test your SEO knowledge in 5 questions

Less than a minute. Find out how much you really know about Google search.

🕒 ~1 min 🎯 5 questions

Official statement

If body-related HTML elements (like iframe, div, p, span) are found in the head tag, the HTML lexer automatically closes the head just before these elements and starts the body from there. This is crucial for content injection into the head.
14:14
🎥 Source video

Extracted from a Google Search Central video

⏱ 31:36 💬 EN 📅 09/12/2020 ✂ 11 statements
Watch on YouTube (14:14) →
Other statements from this video 10
  1. 9:26 Caffeine: How does Google turn crawling into indexing?
  2. 11:02 How does Google really normalize broken HTML on your pages?
  3. 11:12 Does CSS styling of Hn tags really influence their SEO weight?
  4. 12:32 Does Google really index all file formats beyond just HTML?
  5. 13:44 Does the meta keywords tag still hold any significance for SEO?
  6. 13:44 Does the noindex truly prevent Google from processing a document?
  7. 15:52 Can Google really tell the difference between your soft 404s and legitimate content on error pages?
  8. 18:09 Should You Really Deindex Your Out-of-Stock Product Pages?
  9. 23:10 Should you really choose an SEO provider in your time zone?
  10. 24:07 Are third-party crawlers really more reliable than Search Console for testing your SEO changes?
📅
Official statement from (5 years ago)
TL;DR

Google confirms that its HTML lexer automatically closes the <head> tag as soon as it encounters a body-type element (iframe, div, p, span) in that area. Essentially, everything following that element moves to the <body>, making any meta tags, scripts, or structured data placed afterwards ineffective. For SEO, this means a misplaced injection—via a tag manager, a plugin, or a third-party script—can nullify your critical optimizations without triggering any alerts.

What you need to understand

How does the HTML lexer actually interpret the ?

Google's HTML lexer (and modern browsers) applies a strict rule: as soon as an element that is only allowed in the appears in the , the parser considers the to be finished. It automatically closes this section and starts the from that element.

This means that if a

, a , a

, or a sneaks into your —whether intentionally or not—everything following in the source code will be interpreted as part of the . Your meta robots tags, hreflang, canonical, and JSON-LD: all these elements that are critical for SEO become invisible or misplaced in the eyes of Google.

What are the common causes of this pollution?

Most of the time, this error comes from poorly controlled dynamic injections. A hastily configured tag manager, a WordPress plugin that injects content without checking the context, a third-party script that inserts a for tracking: all potential sources of corruption.

Some developers also intentionally place body-type elements in the for perceived performance reasons (asynchronous loading of a widget, for example). But the lexer doesn’t compromise: it applies the rule, period. The technical context or intent doesn't matter to the parser.

Why is Google communicating about this now?

Gary Illyes highlights this behavior because many SEOs still ignore how HTML parsing actually works. They place critical tags in the assuming they will be read in the order of the source code, without checking whether the parser processes them as intended.

This clarification also comes in a context where dynamic content injection is exploding: SPAs (Single Page Applications), client-side hydration, third-party scripts... All situations where the becomes a minefield. Google wants practitioners to understand that the final rendering matters more than the developer’s intent.

  • The HTML lexer closes the as soon as it encounters a body-type element (div, iframe, p, span...)
  • Any critical tag placed after that element switches to the and loses its effectiveness
  • Dynamic injections (tag managers, plugins, third-party scripts) are the main sources of pollution
  • The final rendering perceived by Google takes precedence over the source code intent
  • Checking the rendered DOM (via DevTools or Search Console) is essential to detect these anomalies

SEO Expert opinion

Is this rule really enforced by Googlebot?

Yes, and it’s actually observable by comparing the raw source code and the rendered DOM in the URL Inspection Tool of Search Console. When a body-type element pollutes the , you can clearly see the tag close prematurely in the final HTML rendering, even if your initial source code was clean.

This behavior isn’t specific to Google: it’s a HTML5 standard rule that all modern browsers apply. Googlebot uses Chromium as its rendering engine, so it inherits this logic. However, some older bots or third-party crawlers might interpret that type of structure differently—leading to discrepancies between what you test and what Google actually sees.

What nuances should be added to this statement?

Gary Illyes mentions content injection into the , which often implies dynamic content (JavaScript, tag managers). But the rule also applies to static HTML: if you hard-code a

into the , the outcome will be identical. The lexer makes no distinction between static and dynamic, it parses what it receives.

Be careful as well: some elements are allowed in the but can cause issues if they contain visible content. A or a tag with text outside the appropriate tags might trigger unexpected behavior. [To be checked]: are tags in the containing body-like HTML treated the same way? Field tests show variable behavior depending on Chromium versions.

In what scenarios does this rule really become a problem for SEO?

The danger is greatest when critical SEO tags are dynamically injected after a polluting body element. A typical case: a plugin that adds a for cookie consent at the top of the , followed by a script that injects JSON-LD or hreflang. The result: these tags end up in the , and are thus ignored or misinterpreted by Google.

Let’s be honest: many e-commerce sites use architectures based on tag managers and third-party scripts that inject content into the without checking the execution order. If you have 8 scripts that run asynchronously and one of them places a

before the JSON-LD is inserted, you have a problem—and it’s invisible in the source code; you need to inspect the rendered DOM.
Alert: Sites using CMSs with multiple plugins or SPAs with client-side hydration must absolutely check the final rendering of the in Search Console. A meta tag robots="noindex" placed after a polluting body element might make a page indexable when you thought it was blocked.

Practical impact and recommendations

How can you check that your isn’t polluted?

First step: use the URL Inspection Tool of Search Console. Compare the source code ("Raw HTML" tab) and the rendered DOM ("More info" > "Rendered HTML" tab). If you see critical tags (canonical, hreflang, JSON-LD) appearing in the while they are in the of the source code, you have a pollution issue.

Second method: open the Chrome DevTools (F12), go to the "Elements" tab, and inspect the . Look for body-type elements like

, ,

, or . If there are any, identify their origin (third-party script, plugin, manual injection) and remove or move them to the .

What mistakes should be absolutely avoided?

Never place visual elements or structural content in the , even for performance reasons. If you want to load a widget or an iframe first, use a preload or prefetch in the , but inject the actual element in the .

Also, avoid blindly trusting third-party plugins or scripts. Some tracking tools, cookie consent options, or live chat plugins inject HTML into the without adhering to standards. Always test the final rendering after installing a new tool. And if you’re using a tag manager, ensure that critical tags (meta, link, script type="application/ld+json") are injected before any body-like elements.

What concrete steps should be taken to fix this problem?

If you detect a body element in the , identify its source. If it comes from a plugin, look for an option to disable that injection or move the code. If it originates from a third-party script, contact the provider or replace the tool. If it’s hard-coded, remove it from the template.

Once the source is eliminated, retest with Search Console and ensure that the critical tags are indeed in the of the rendered DOM. Also perform a diff between the source code and the rendering to spot any other anomalies. Finally, set up an automated alert (via a monitoring tool like Oncrawl, Botify, or Screaming Frog Cloud) to detect any re-emergence of the issue after a site update.

  • Inspect the rendered DOM in Search Console and DevTools to spot body elements in the
  • Identify the origin of each polluting element (plugin, third-party script, manual injection)
  • Remove or move these elements to the
  • Ensure that critical SEO tags (canonical, hreflang, JSON-LD, meta robots) are present in the of the final rendering
  • Set up automatic monitoring to detect any reemergence of the issue
  • Systematically test the rendering after each addition of a script or plugin
Pollution of the by body-type elements is a sneaky technical issue that can nullify your critical SEO optimizations without triggering any visible errors. Regular manual audits and automated monitoring are essential to maintain a clean . If your technical architecture is complex (SPA, multiple third-party scripts, nested tag managers), these checks can quickly become time-consuming and require specialized expertise. In this context, calling upon a specialized SEO agency for technical SEO advice can be wise: they have the tools and experience to diagnose these anomalies, automate monitoring, and establish sustainable guardrails adapted to your technical stack.

❓ Frequently Asked Questions

Quels éléments HTML sont autorisés dans le <head> ?
Les éléments autorisés dans le <head> sont : <title>, <meta>, <link>, <style>, <script>, <base>, <noscript>. Tout autre élément (div, iframe, p, span…) provoque la fermeture automatique du <head> par le lexer.
Un élément body dans le <head> peut-il empêcher l'indexation d'une page ?
Indirectement, oui. Si un élément body pollue le <head> avant une balise meta robots="noindex", cette directive bascule dans le <body> et peut être ignorée par Google, rendant la page indexable alors que vous pensiez la bloquer.
Les tag managers provoquent-ils souvent ce type de problème ?
Oui, surtout quand plusieurs scripts s'exécutent de manière asynchrone. Si un script injecte un <div> ou un <iframe> avant qu'un autre n'insère le JSON-LD ou les hreflang, ces balises critiques se retrouvent dans le <body>.
Comment savoir si mes balises SEO sont bien dans le <head> côté Google ?
Utilisez l'outil d'inspection d'URL de Search Console et comparez le code source brut au DOM rendu (onglet "Plus d'infos" > "Rendu HTML"). Si vos balises critiques apparaissent dans le <body> du rendu, vous avez un problème de pollution.
Un <noscript> dans le <head> peut-il poser problème ?
Cela dépend de son contenu. Si le <noscript> contient uniquement des balises autorisées dans le <head> (meta, link), pas de souci. S'il contient du HTML body-like (div, p…), le comportement peut être imprévisible selon la version de Chromium utilisée par Googlebot.
🏷 Related Topics
Content JavaScript & Technical SEO

🎥 From the same video 10

Other SEO insights extracted from this same Google Search Central video · duration 31 min · published on 09/12/2020

🎥 Watch the full video on YouTube →

Related statements

💬 Comments (0)

Be the first to comment.

2000 characters remaining
🔔

Get real-time analysis of the latest Google SEO declarations

Be the first to know every time a new official Google statement drops — with full expert analysis.

No spam. Unsubscribe in one click.