Skip to content

Files

Latest commit

 

History

History
32 lines (22 loc) · 692 Bytes

no-head-element.md

File metadata and controls

32 lines (22 loc) · 692 Bytes

Pattern: Use of <head>

Issue: -

Description

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.

Possible Ways to Fix It

Import and use the <Head /> component:

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

Further Reading