rsnext/errors/no-title-in-document-head.md
Eliaz Bobadilla 1d026ec074
class component -> functional component (#41089)
easier to read

## Documentation / Examples

- [x ] Make sure the linting passes by running `pnpm lint`
- [ x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2022-10-01 20:18:49 +00:00

814 B

No Title in Document Head

Prevent usage of <title> with Head component from next/document.

Why This Error Occurred

A <title> element was defined within the Head component imported from next/document, which should only be used for any <head> code that is common for all pages. Title tags should be defined at the page-level using next/head instead.

Possible Ways to Fix It

Within a page or component, import and use next/head to define a page title:

import Head from 'next/head'

export function Home() {
  return (
    <div>
      <Head>
        <title>My page title</title>
      </Head>
    </div>
  )
}