Metadata Functions

This is the quick-lookup version of the functions used to generate a route's metadata, static params, and sitemap entries at build or request time. For the full explanation, see the HTML <head> chapter and its sub-pages.

generateMetadata(props) An async function exported from layout.js or page.js that returns a Metadata object computed from route params, search params, or fetched data. Server Components only; use the static metadata object export instead when nothing dynamic is needed.
generateStaticParams() Exported from a dynamic segment's layout.js or page.js to list the param combinations that should be statically generated at build time, similar in spirit to getStaticPaths() in the older Pages Router.
generateViewport(props) An async sibling of generateMetadata() dedicated to viewport-related values (theme color, width, initial scale) that depend on runtime data. Use the static viewport object export instead when the values are fixed.
generateSitemaps() Exported from sitemap.js to split a large sitemap into multiple generated sitemap files, returning an array of id objects that Next.js uses to call your default export once per chunk.