What does Google say about SEO? /

Official statement

Elements like rel canonical, meta robots tags, and hreflang must be in the head section of the page. If body elements appear before in the head, the browser will prematurely open the body and Google will not take these important tags into account.
19:27
🎥 Source video

Extracted from a Google Search Central video

⏱ 56:54 💬 EN 📅 16/10/2020 ✂ 39 statements
Watch on YouTube (19:27) →
Other statements from this video 38
  1. 2:02 Are link exchanges for content really punishable by Google?
  2. 2:02 Can you really use lazy loading and data-nosnippet to control what Google displays in the SERPs?
  3. 2:22 Can exchanging content for backlinks trigger a Google penalty?
  4. 2:22 Should you really use data-nosnippet to control your search snippets?
  5. 2:22 Should you really ban external reviews from your Schema.org structured data?
  6. 3:38 Does a 1:1 domain migration truly transfer ALL ranking signals?
  7. 3:39 Does a domain migration really transfer all ranking signals?
  8. 5:11 Why doesn't merging two websites ever double your SEO traffic?
  9. 5:11 Why does merging two websites lead to traffic loss even with perfect redirects?
  10. 6:26 Should you really think twice before splitting your site into multiple domains?
  11. 6:36 Is splitting a website into multiple domains a strategic mistake to avoid?
  12. 8:22 Can a polluted domain really handicap your SEO for over a year?
  13. 8:24 Can the history of an expired domain hold back your rankings for months?
  14. 14:03 Does Google really evaluate Core Web Vitals by section or does it apply to the entire domain?
  15. 14:06 Can Google really evaluate Core Web Vitals section by section on your site?
  16. 19:58 Why can your critical SEO tags be completely ignored by Google?
  17. 23:39 Do you really need to specify a time zone in the lastmod tag of your XML sitemap?
  18. 23:39 How might a missing timezone in your XML sitemaps jeopardize your crawl?
  19. 24:40 Why does Google ignore identical lastmod dates in your XML sitemaps?
  20. 24:40 Why does Google ignore identical modification dates in XML sitemaps?
  21. 25:44 How does alternating between noindex and index jeopardize your crawl budget?
  22. 25:44 Is alternating between index and noindex really dooming your pages to Google's oblivion?
  23. 29:59 Does the Ad Experience Report really influence Google rankings?
  24. 29:59 Does the Ad Experience Report really influence Google rankings?
  25. 33:29 Is it really necessary to break all your pagination links for Google to prioritize page 1?
  26. 33:42 Should you really prioritize incremental linking for pagination instead of linking everything from page 1?
  27. 37:31 Why do your rendering tests fail while Google indexes your page correctly?
  28. 39:27 How does Google really index your pages: by keywords or by documents?
  29. 39:27 Does Google really create keywords from your content, or is the process the other way around?
  30. 40:30 How does Google manage to comprehend 15% of queries it has never seen before through machine learning?
  31. 43:03 Why does recovery from a Page Layout penalty take months?
  32. 43:04 How long does it really take to recover from a Page Layout Algorithm penalty?
  33. 44:36 Does Google impose a maximum threshold for ads within the viewport?
  34. 47:29 Does content syndication really harm your organic search ranking?
  35. 51:31 Does a 302 redirect ultimately equate to a 301 in terms of SEO?
  36. 51:31 Should You Really Worry About 302 Redirects During a Migration Error?
  37. 53:34 Should you really host your news blog on the same domain as your product site?
  38. 53:40 Should you isolate your blog or news section on a separate domain?
📅
Official statement from (5 years ago)
TL;DR

Google does not take into account critical tags (canonical, meta robots, hreflang) if they are outside the <head> section. Specifically, if <body> elements appear prematurely in the code, the browser automatically closes the <head> and Google ignores all subsequent directives. Ensure that your HTML strictly follows the order <head> then <body>, otherwise your indexing directives fall into a void.

What you need to understand

What causes the premature closing of the ?

The browser follows a strict logic: as soon as it encounters a <body> element, it considers the <head> section finished. If your code accidentally places a <body> element — or any content that triggers its opening — before your canonical, hreflang, or meta robots tags, these end up technically outside the <head>.

Google will not make the effort to look for them elsewhere. Googlebot's HTML parser adheres to standards: anything not in the <head> at the time of the initial parsing is simply not processed as an indexing directive. The result? Your directives fall into oblivion.

Why is this rule so rarely discussed?

Because for the majority of well-constructed sites, the issue never arises. Modern CMSs and frameworks usually adhere to this structure. The problem mainly occurs with poorly coded templates, outdated WordPress plugins, or hazardous JavaScript injections that pollute the DOM order before the final rendering.

It's a silent bug: no warnings in the Search Console, no visible error messages. You think you have correctly implemented your tags, but they are never taken into account. And that's where the issue lies.

Which HTML elements are affected by this requirement?

The rel="canonical", meta name="robots", and hreflang tags are the most critical. But the rule also applies to title, meta description, and all directives intended for search engines or social parsers.

If your <head> closes too early, all these tags become invisible to Google. The engine will make no exceptions or attempts to recover. It's all or nothing.

  • Affected critical tags: canonical, meta robots, hreflang, title, meta description
  • Main cause: <body> elements inserted too early in the HTML code
  • Symptom: SEO directives ignored without visible error message
  • Risky contexts: poorly coded WordPress plugins, custom templates, JavaScript injections before final rendering
  • Recommended check: raw source code inspection and HTML validation via W3C Validator

SEO Expert opinion

Is this statement really a novelty for SEO practitioners?

No. HTML specs have always required that the <head> precede the <body>. But Mueller's statement clarifies a crucial point: Google makes no exceptions to this rule, even if some browsers are more lenient. In other words, even if your page displays correctly on the user side, Googlebot can ignore your directives if they are poorly placed.

What is surprising is how often this issue goes unnoticed. I've seen international sites with hreflang tags being poorly considered for months simply because a plugin injected a script in the wrong order. No standard automated audit detects this — you need to inspect the raw code.

What nuances should be added to this statement?

Mueller talks about the behavior of the browser, but it's the Googlebot parser that counts. However, Googlebot does not necessarily execute JavaScript the same way as a modern browser. If your tags are dynamically injected via JS after the initial rendering, they may never be seen by Google, even if they technically end up in the <head>.

Another nuance: [To be checked] Google could theoretically retrieve certain tags through complete JavaScript rendering, but there are no guarantees. The official recommendation remains to place these tags in the initial raw HTML, not to rely on JS to inject them later.

In which cases does this rule pose practical problems?

The most affected sites are those using visual page builders (Elementor, Divi, etc.) or complex JavaScript stacks (React, Vue in poorly configured SSR). These tools manipulate the DOM aggressively and can create non-compliant HTML structures without the developer realizing it.

I've also seen cases where tracking scripts (GTM, advertising pixels) were inserted too early in the <head> and triggered the premature opening of the <body>. Result: the SEO tags placed after these scripts were never read. Check the injection order of your third-party scripts — it's often the hidden cause.

Practical impact and recommendations

What practical steps should be taken to avoid this problem?

First step: inspect the raw source code of your strategic pages. Not the DOM after JavaScript rendering — the initial HTML code returned by the server. Look for the exact location of your canonical, hreflang, and meta robots tags. They must all appear before the closing </head> tag.

Second step: run your HTML through the W3C Validator. It will detect structural errors, including incorrectly placed <body> elements or orphaned tags that could force the premature closing of the <head>. Valid HTML is not a luxury, it is a prerequisite for Google to process your directives correctly.

What mistakes should be absolutely avoided?

Never place visible content (text, images, styled divs) before the <body> tag. Some developers insert cookie banners or maintenance messages directly after the <head> without formally opening the <body> — a fatal mistake. The browser will automatically open the <body>, and everything that follows in the <head> will be ignored.

Another trap: scripts manipulating the DOM before complete rendering. If a script inserts a <body> element or triggers its opening before all your SEO tags are in place, you find yourself in the same situation. Audit your third-party scripts and their execution order.

How can I check if my site is compliant and Google is processing my tags?

Use Google Search Console and the URL inspection tool to see the rendered HTML as Googlebot sees it. Compare it to the raw source code. If your canonical or hreflang tags do not appear in the rendered version, it means they were ignored.

Another practical test: request Google to crawl your page using the structured data testing tool or the inspection tool. If your tags are not detected, they are poorly placed or injected too late. Correct the HTML order or adjust your SSR if you are using a JavaScript framework.

  • Inspect the raw HTML source code (not the DOM after JS) of your strategic pages
  • Ensure that canonical, hreflang, and meta robots appear before </head>
  • Run your HTML through the W3C Validator to detect structural errors
  • Audit the injection order of third-party scripts (GTM, pixels, analytics)
  • Use the URL inspection tool in Google Search Console to see the HTML rendered by Googlebot
  • Test your tags using Google's structured data testing tool
These HTML optimizations may seem trivial, but they require a technical rigor and a deep understanding of server-side rendering, browser parsing, and Googlebot behavior. If you suspect your site suffers from this type of structural error — or if you want to ensure that your critical tags are interpreted correctly — consulting a specialized SEO agency can save you months of invisible traffic losses. A thorough technical audit will detect these silent bugs and allow you to correct the foundation before losing ground to your competitors.

❓ Frequently Asked Questions

Quels éléments HTML doivent impérativement rester dans le <head> ?
Les balises canonical, meta robots, hreflang, ainsi que toutes les directives destinées aux moteurs de recherche. Si elles sortent du <head>, Google ne les traite pas.
Comment savoir si mon <head> se ferme prématurément ?
Inspectez le code source HTML ou utilisez les DevTools de votre navigateur. Si un élément <body> apparaît avant la fin de vos balises SEO, le <head> se fermera automatiquement avant elles.
Les balises hreflang peuvent-elles être placées dans le <body> via JavaScript ?
Non. Google n'interprétera pas les balises hreflang injectées dynamiquement dans le <body>. Elles doivent figurer dans le <head> initial au moment du crawl.
Un plugin WordPress peut-il causer ce type d'erreur ?
Absolument. Certains plugins mal codés insèrent du contenu avant la balise <head> ou placent des éléments <body> trop tôt, ce qui ferme le <head> prématurément.
Cette règle s'applique-t-elle aussi aux balises Open Graph et Twitter Cards ?
Pour le SEO strict, seules canonical, robots et hreflang sont critiques. Les balises sociales (OG, Twitter) sont lues par d'autres parseurs moins rigides, mais mieux vaut les garder dans le <head> par cohérence.
🏷 Related Topics
Domain Age & History Crawl & Indexing AI & SEO International SEO

🎥 From the same video 38

Other SEO insights extracted from this same Google Search Central video · duration 56 min · published on 16/10/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.