# no-duplicate-head

Rule `nextjs/no-duplicate-head`. Prevent duplicate usage of `<Head>` in `pages/_document.js`.

- Source: nextjs
- Technologies: Next.js, React
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 99.7M weekly downloads of presets that enable it
- Trend: +49.8% last quarter
- Rank: #165 by reach, #832 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@next/next/no-duplicate-head` | yes | no | package `@next/eslint-plugin-next` | [docs](https://nextjs.org/docs/messages/no-duplicate-head) |
| Oxlint | `nextjs/no-duplicate-head` | no | no | plugin `nextjs`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/nextjs/no-duplicate-head.html) |

## Code examples

### Incorrect: the rule reports this

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

### Correct: the rule accepts this

```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
```

Examples from the Oxlint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import next from "@next/eslint-plugin-next";

export default [
  {
    plugins: { "@next/next": next },
    rules: {
      "@next/next/no-duplicate-head": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "nextjs"
  ],
  "rules": {
    "nextjs/no-duplicate-head": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Next.js recommended](https://lintradar.dev/presets/next-recommended.md) | ESLint | `@next/eslint-plugin-next` | 22 | 52.9M | +50.7% |
| [Next.js Core Web Vitals](https://lintradar.dev/presets/next-core-web-vitals.md) | ESLint | `eslint-config-next` | 62 | 46.8M | +48.8% |

## Related rules

- [nextjs/no-css-tags](https://lintradar.dev/rules/nextjs/no-css-tags.md): Prevent manual stylesheet tags.
- [nextjs/no-html-link-for-pages](https://lintradar.dev/rules/nextjs/no-html-link-for-pages.md): Prevent usage of `<a>` elements to navigate to internal Next.js pages.
- [nextjs/no-assign-module-variable](https://lintradar.dev/rules/nextjs/no-assign-module-variable.md): Prevent assignment to the `module` variable.
- [nextjs/no-page-custom-font](https://lintradar.dev/rules/nextjs/no-page-custom-font.md): Prevent page-only custom fonts.
- [nextjs/no-before-interactive-script-outside-document](https://lintradar.dev/rules/nextjs/no-before-interactive-script-outside-document.md): Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.
- [nextjs/no-script-component-in-head](https://lintradar.dev/rules/nextjs/no-script-component-in-head.md): Prevent usage of `next/script` in `next/head` component.

---

Web page: https://lintradar.dev/rules/nextjs/no-duplicate-head. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
