metadata object
Static export defining the document head metadata for a route.
Syntax
export const metadata: Metadata = { title, description, ... } Returns
Metadata — Static metadata merged into <head>.
Examples
// app/layout.tsx
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: {
default: 'My Site',
template: '%s | My Site',
},
description: 'A great Next.js site',
metadataBase: new URL('https://example.com'),
}
// app/about/page.tsx
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'About',
openGraph: { title: 'About Us', type: 'website' },
robots: { index: true, follow: true },
}
Notes
Use the static `metadata` export when values do not depend on
runtime data; use `generateMetadata()` when they do (you cannot use
both in the same file). Child segment metadata is deep-merged with
parents. Set `metadataBase` so relative OG/canonical URLs resolve.
Server Components only.