Skip to content

nextjs/no-duplicate-head Correctness

What it does

Prevent duplicate usage of <Head> in `pages/_document.js``.

Why is this bad?

This can cause unexpected behavior in your application.

Example

jsx
import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
  static async getInitialProps(ctx) {}
  render() {
    return (
      <Html>
        <Head />
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}
export default MyDocument;

References

Released under the MIT License.