2023-07-05 15:11:16 +02:00
---
title: No Title in Document Head
---
2021-05-07 10:49:37 +02:00
2022-06-14 04:17:42 +02:00
> Prevent usage of `<title>` with `Head` component from `next/document`.
2023-07-05 15:11:16 +02:00
## Why This Error Occurred
2021-05-07 10:49:37 +02:00
2022-06-14 04:17:42 +02:00
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.
2021-05-07 10:49:37 +02:00
2023-07-05 15:11:16 +02:00
## Possible Ways to Fix It
2021-05-07 10:49:37 +02:00
Within a page or component, import and use `next/head` to define a page title:
2023-07-05 15:11:16 +02:00
```jsx filename="pages/index.js"
2021-05-07 10:49:37 +02:00
import Head from 'next/head'
2022-10-01 22:18:49 +02:00
export function Home() {
return (
<div>
<Head>
<title>My page title</title>
</Head>
</div>
)
2021-05-07 10:49:37 +02:00
}
```
2023-07-05 15:11:16 +02:00
## Useful Links
2021-05-07 10:49:37 +02:00
2023-07-05 15:11:16 +02:00
- [next/head](/docs/pages/api-reference/components/head)
- [Custom Document](/docs/pages/building-your-application/routing/custom-document)