Issues

Validation: <head> Not First In <html> Element

back to issues overview

<head> Not First In <html> Element

Pages with an HTML element that proceed the <head> element in the HTML. The <head> should be the first element in the <html> element.

Browsers and Googlebot will automatically generate a <head> element if it’s not first in the HTML.

While ideally <head> elements would be in the <head>, if a valid <head> element is first in the <html> it will be considered as part of the generated <head>.

However, if non <head> elements such as <p>, <body>, <img> etc are used before the intended <head> element and its metadata, then Google assumes the end of the <head> element.

This means the intended <head> element and its metadata will be seen in the <body> and ignored.

How to Analyse in the SEO Spider

View URLs with this issue in the ‘Validation’ tab and ‘<head> Not First In <html> Element’ filter, and export all URLs using the ‘Export’ button.

Read our tutorial on ‘How To Debug Invalid HTML Elements In The Head‘.

What Triggers This Issue

This issue is triggered when pages have an HTML element other than the <head> preceding the <head> element within the <html> structure.

Example:

<!DOCTYPE html>
<html>
<body>
...
</body>
<head>
...
</head>
</html>

How To Fix

Ensure all pages have a valid <head> element with appropriate metadata for the document that is the first element in the <html> element.

Further Reading

Back to top