return {
    title: 'Next.js',
  }
}
 
export default function Page({ params, searchParams }: Props) {}
With parent metadata
 import type { Metadata, ResolvingMetadata } from 'next'
 
export async function generateMetadata(
  { params, searchParams }: Props,
  parent: ResolvingMetadata
): Promise<Metadata> {
  return {
    title: 'Next.js',
  }
}
JavaScript Projects
For JavaScript projects, you can use JSDoc to add type safety.
 /** @type {import("next").Metadata} */
export const metadata = {
  title: 'Next.js',
}
Version History
VersionChangesv13.2.0metadata and generateMetadata introduced.