Q17: How does next/head manage document metadata in the Pages Router?

The <Head> component from next/head allows appending metadata tags (<title>, <meta>, <link>) to the HTML <head> section from individual page files.

Adding Page Metadata with next/head
import Head from 'next/head';

export default function About() {
  return (
    <div>
      <Head>
        <title>About Us | My Company</title>
        <meta name="description" content="Learn about our mission" key="desc" />
      </Head>
      <p>About Page Content</p>
    </div>
  );
}

next/head hoists title and description tags into the document head region.

Key Takeaways
  • Injects HTML head metadata from page components.

  • Use the key attribute to prevent duplicate meta tag rendering.

Knowledge Check

Why should you add a key attribute to meta tags inside next/head?