Skip to content
TrademarkTrademark
Docs
Modules

Meta

Updated: May 13, 2025
View on GitHub

Generate SEO-friendly metadata for your Next.js pages including OpenGraph and Twitter/X cards.

Add metadata directly to your pages using the Meta.generate function:

Advanced setup

For larger sites, store your metadata in a central configuration file to maintain consistency across pages:

1. Config file

Store your site-wide metadata in a configuration file:

2. Reference

Reference the configuration in your pages:

This approach makes it easier to maintain consistent metadata across your site and update it from a single location.

Social image route

Without an image, Meta.generate points the Open Graph and X images at /api/og/generate?title=…, a route you render with next/og. If yours lives elsewhere, pass ogRoutes; the same object can be given to OgRoutesProvider for OgCard.

Output

The Meta.generate function will generate all necessary meta tags for SEO and social sharing:

API reference

Meta.generate takes one object:

Type
Default
titlerequired
string—
descriptionrequired
string—
baseURLrequired
string—
path
string""
type
websitearticle
website
image
string—
publishedTime
string—
author
{ name: string; url?: string; }—
canonical
string—
robots
string—
noindex
boolean—
nofollow
boolean—
alternates
Alternate[]—
ogRoutes
Partial<OgRoutes>—
Edit this page on GitHub