Engineering

Metadata and SEO in Next.js with the Metadata API

Jun 14, 20268 min read1,130 views
Next.jsSEOMetadata

Metadata and SEO in Next.js with the Metadata API

Search engines and social platforms read the head of your page. Next.js lets you define this metadata in plain exported objects.

Static and dynamic metadata

Export a metadata object for static values, or a generateMetadata function to build titles and descriptions from route params.

Open Graph and Twitter cards

Rich sharing previews come from Open Graph and Twitter metadata. Set the image, title, and description so links look great when shared.

Structuring titles

Use a title template in the root layout so every route inherits a consistent brand suffix without repeating it by hand.

Wrapping up

Good metadata is cheap to add and pays off in search visibility and share quality. Make it part of every route you ship.

Share this article

Back to all posts