Description
What version of Next.js are you using?
10.0.5
What version of Node.js are you using?
12.20.1
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
When using an unsupported/invalid tag in next/head
, the console shows an unhelpful next-head-count is missing
error and the content of next/head
ends up in the body
tag.
Example:
<Head>
{/* The following line causes an error */}
<html lang="en" />
<title>Demo Page</title>
</Head>
Expected Behavior
Next.js should warn about the offending tag and gracefully ignore it.
To Reproduce
https://github.com/aengl/next-head-count-missing
Check out the project, run it via yarn dev
and check the console output on the index page to see the error. Check the inspector to verify that the title
tag was written into the HTML body.
Remove line 6 in components/SEO.tsx
and the error will disappear:
<html lang="en" />
More extensive discussion of this error can be found here: #19361