Warningsocial.tags-in-body

Sharing tags are outside <head>

Why it matters

Open Graph and Twitter tags belong in <head>: the protocol says so, and WhatsApp states that it only reads them there. They usually end up in <body> by accident. HTML doesn't allow elements such as <div>, <img> or <iframe> inside <head>, so when a plugin or a tracking snippet puts one there, the browser and every scraper treat it as the end of the head, and every tag after it is, as far as they are concerned, in the body. The page source looks fine; the parsed page isn't. Scrapers that stop at the end of the head then show a bare link.

Sources: The Open Graph protocol ("placing additional <meta> tags in the <head> of your web page"); WhatsApp link previews. Facebook doesn't say either way, which is why this is a warning rather than an error.

How to fix it

Move the sharing tags up so they come straight after <meta charset> and <title>, before any scripts or third-party snippets. If they are already there in your template, look for the element that ends the head early: view the page source and find the first thing inside <head> that isn't <meta>, <link>, <title>, <style>, <script>, <base> or <noscript>. A <noscript><img …></noscript> tracking pixel is the usual culprit: move it to the top of <body>.

Examples

These are the rule's own test pages, and what it says about each. They are run on every change to the rule book.

<html lang="en">
<title>Flour &amp; Co</title>
<meta name="description" content="Still in the head">
<img height="1" width="1" src="https://tracker.example/pixel.gif">
<meta property="og:title" content="x">
<meta property="og:image" content="https://www.example.com/share.png">

Warning2 sharing tags are outside <head>, where WhatsApp and other scrapers don't look: og:title, og:image.

fail-pixel-ends-head
<html lang="en">
<title>Flour &amp; Co</title>
<meta property="og:title" content="x">
<meta property="og:image" content="https://www.example.com/share.png">

PassedThe sharing tags are all inside <head>.

pass-in-head