no-document-title.mdx


title: '<title> should not be used in _document.js <Head>'

Why This Error Occurred

Adding <title> in pages/_document.js will lead to unexpected results with next/head since _document.js is only rendered on the initial prerender.

Possible Ways to Fix It

Set <title> in pages/_app.js instead:

import React from 'react'
import Head from 'next/head'

function MyApp({ Component, pageProps }) {
  return (
    <>
      <Head>
        <title>My new cool app</title>
      </Head>
      <Component {...pageProps} />
    </>
  )
}

export default MyApp

Rendered from the public repository vercel/next.js on GitHub; content belongs to its authors. Cached for up to an hour.

errors/no-document-title.mdx · vercel/next.js | Docs MD