2023-07-05 15:11:16 +02:00
---
title: No Head Element
---
2021-12-31 06:09:44 +01:00
2022-06-14 04:17:42 +02:00
> Prevent usage of `<head>` element.
2023-07-05 15:11:16 +02:00
## Why This Error Occurred
2021-12-31 06:09:44 +01:00
2022-06-14 04:17:42 +02:00
A `<head>` element was used to include page-level metadata, but this can cause unexpected behavior in a Next.js application. Use Next.js' built-in `next/head` component instead.
2021-12-31 06:09:44 +01:00
2023-07-05 15:11:16 +02:00
## Possible Ways to Fix It
2021-12-31 06:09:44 +01:00
Import and use the `<Head />` component:
2023-07-05 15:11:16 +02:00
```jsx filename="pages/index.js"
2021-12-31 06:09:44 +01:00
import Head from 'next/head'
function Index() {
return (
<>
<Head>
<title>My page title</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
</Head>
</>
)
}
export default Index
```
2023-07-05 15:11:16 +02:00
## Useful Links
2021-12-31 06:09:44 +01:00
2023-07-05 15:11:16 +02:00
- [next/head](/docs/pages/api-reference/components/head)