Skip to content

Files

Latest commit

 

History

History
39 lines (32 loc) · 662 Bytes

no-head-element.md

File metadata and controls

39 lines (32 loc) · 662 Bytes

Pattern: HTML head element

Issue: -

Description

The HTML head element should not be used directly in Next.js applications. Use the Head component from next/head instead to properly manage head elements across pages.

Examples

Example of incorrect code:

export default function Page() {
  return (
    <div>
      <head>
        <title>Page Title</title>
      </head>
      <div>Content</div>
    </div>
  )
}

Example of correct code:

import Head from 'next/head'

export default function Page() {
  return (
    <div>
      <Head>
        <title>Page Title</title>
      </Head>
      <div>Content</div>
    </div>
  )
}