Skip to Content

Page title outside the head

What it is

The page has a <title> element that ends up in the <body>, either next to a title in its <head> or as its only title. Titles belong in the head only. Usually the title was written in the head, but an element that is not allowed there, such as an <img>, <div> or <iframe>, came before it. Browsers and crawlers treat that element as the start of the body, so everything after it, the title included, is read as body content.

Why it matters

Google says that when it meets an invalid element in the head , it ignores the elements that follow it. The stray title is often the visible symptom: a meta description, canonical, robots or hreflang tag placed after the same point may be ignored too, and that usually costs more than the title itself. Fixing the cause restores all of them at once.

How Asky checks it

Asky parses the page’s raw HTML the way a browser does, so a stray element closes the head early just as it would in a browser, while a <title> placed between </head> and <body> is moved back into the head, where it counts toward more than one page title instead. The page is reported when any <title> is inside <body>, whether or not the head has one too. A <title> inside an SVG image is ignored, and titles set by JavaScript are not seen. When the body holds the only title, the length and same-as-H1 checks are skipped. A meta description after the same stray element may be reported as outside the head too.

Reported as an error with high severity.

How to fix it

  1. Open the page source and read the head from the top. Find the first element that is not <title>, <meta>, <link>, <script>, <style>, <base>, <noscript> or <template>. Common culprits are a tracking pixel <img>, an <iframe> from a chat or consent snippet, a <div> added by a plugin, and stray text.
  2. Move that element into the body. If a snippet insists on the head, place it after all your metadata.
  3. If the head already has a title of its own, remove the one that was pushed out: once the head is repaired it moves back into the head, where two titles are reported as more than one page title.
  4. If the second title was typed into page content, for example in an embed or rich text block, delete it and use a heading for visible text.
  5. Check that the meta description, canonical and robots tags that followed the stray element are now inside the head.

Example

On https://example.com/pricing a tracking pixel in the head pushes a plugin’s title and the description into the body:

<!-- Before: the <img> ends the head, so the second title and the description land in the body --> <head> <title>Pricing Plans for Teams and Agencies | Example Co</title> <img src="https://example.com/pixel.gif" width="1" height="1" alt=""> <title>Pricing</title> <meta name="description" content="Compare plans for teams and agencies, with monthly or yearly billing and a free trial."> </head> <!-- After: one title, and the pixel moved to the start of the body --> <head> <title>Pricing Plans for Teams and Agencies | Example Co</title> <meta name="description" content="Compare plans for teams and agencies, with monthly or yearly billing and a free trial."> </head> <body> <img src="https://example.com/pixel.gif" width="1" height="1" alt="">

← Back to Page Title

Last updated on