SEO Tools

Next.js metadata previewer.

Paste an export const metadata or the object a generateMetadata function returns. See the <head> tags the App Router emits for title, description, canonical, robots, Open Graph, and Twitter.

Next.js 16 docsNo eval, paste-onlyTitle templates · metadataBase
Advertisement

Metadata

An export const metadata, a generateMetadata function, or a bare { ... }. Variables become {{placeholders}}; nothing is executed.
Paste the layout to see its title.template and metadataBase applied. Fields merge shallowly, as in Next.js.
Examples

Privacy note: the code is read by a small parser in this browser. It is never evaluated and nothing is uploaded. The preview shows what the documentation says Next.js emits for the fields listed below; it does not run your app, so it is not proof of what a deployed page serves.

Expected <head>

Paste metadata and press Preview head tags.

Advertisement

How the preview is built

Title templates

title.template (for example %s | Acme) applies to child segments only, never to the segment that defines it, and needs a title.default. title.absolute skips the parent template. Source: Next.js docs, title section.

Merging

Metadata from layouts down to the page merges shallowly. If a page defines openGraph, it replaces the layout’s whole openGraph object rather than adding to it. The parent box lets you check this.

metadataBase

Relative URLs in canonical, alternates, Open Graph, and Twitter images are joined to metadataBase. Without one, a relative URL is a build error in Next.js, so the preview flags it as an error.

Worked example

Layout: title: { template: '%s | Acme', default: 'Acme' } and metadataBase: new URL('https://acme.com'). Page: title: 'About' and alternates: { canonical: '/about' }. Result: <title>About | Acme</title> and <link rel="canonical" href="https://acme.com/about" />. Load the first example to try it.

Fields covered

title, description, metadataBase, alternates (canonical, languages, media, types), robots (index, follow, noimageindex, max-* and googleBot), openGraph (title, description, url, siteName, locale, type, images, videos, audio, publishedTime, authors), and twitter (card, siteId, creator, creatorId, title, description, images). Other valid fields such as icons or verification are reported as not rendered. Docs checked against Next.js 16.3.8, page last updated 2026-08-25.

Advertisement

Next.js metadata questions

Does this run my generateMetadata function?

No. It reads the returned object literal and never executes code. Values that come from variables, fetches, or expressions (like product.title) show as {{product.title}} placeholders, so you can still check the structure.

Why is my layout title template not applied to the layout’s own page?

Per the Next.js docs, a template applies to child segments, not the segment that defines it. A page.js in the same folder as the layout that defines the template does not get it; a page in a nested folder does.

Does a matching preview mean Google will index or show it this way?

No. It confirms what the Next.js documentation says the metadata renders to. Search engines choose their own titles and snippets, and the deployed page may differ. Use the Meta Tag Analyzer on the live URL to check what is actually served.

What about fields this tool does not render?

They are listed in the notes under the preview, not guessed at. Only output shown in the Next.js documentation examples is reproduced.

Should I use the metadata object or generateMetadata?

Use the static metadata object when the tags do not depend on request information, as the Next.js docs advise, and generateMetadata when they depend on route params, fetched data or parent metadata. A route segment cannot export both, and both are supported only in Server Components.

Why did my page lose the openGraph fields from my layout?

Next.js shallowly merges metadata from segments in the same route, so a page that defines openGraph replaces the layout's whole openGraph object rather than adding to it. Repeat the fields you still need in the page, or read the parent metadata in generateMetadata. The previewer's parent box shows this effect.

What is metadataBase for?

It sets a base URL that Next.js joins to relative paths in URL-based metadata fields such as canonical, alternates and Open Graph images. Setting it once in the root layout lets every route use short paths, and without it relative URLs in those fields are an error.

Sources

Two ways to set metadata in the App Router

The Next.js documentation describes two mechanisms: export a static metadata object, or export an async generateMetadata function that returns one. The docs say a route segment cannot export both, that both are only supported in Server Components, and that you should use the static object when the metadata does not depend on request information. Use generateMetadata when the tags depend on route parameters, fetched data or the metadata of parent segments. This previewer takes the object literal, whether you copy it from export const metadata or from the return of generateMetadata, and shows the head tags Next.js documents for it.

What the function receives

In the current docs, generateMetadata takes a props object with params and searchParams, both Promises, plus a second argument, parent, for reading the metadata resolved from parent segments. A typical product page therefore starts with const { id } = await params, fetches the product, and returns an object such as { title: product.title, openGraph: { images: [product.image] } }. The docs add that fetch requests made inside generateMetadata are automatically memoized for the same data across generateMetadata, generateStaticParams, layouts, pages and Server Components, so you do not need to hoist the fetch to avoid duplicating it. The previewer never runs this function. Anything that is not a literal, such as product.title, shows as a {{product.title}} placeholder so you can still check the structure of what you return.

Worked examples

Title templates, step by step

Root layout: title: { template: '%s | Acme', default: 'Acme' }. A page in a nested folder that sets title: 'About' renders <title>About | Acme</title>. A page that sets title: { absolute: 'About' } renders <title>About</title>, because the docs say title.absolute ignores the template set in parent segments. The route that has no title of its own gets Acme from title.default. And per the docs, title.template applies to child route segments and not the segment it is defined in, so a page.js beside the layout that defines the template does not receive it; that is the usual cause of "my template is not being applied".

Shallow merging

The docs say metadata exported from several segments of the same route is shallowly merged, with duplicate keys replaced in evaluation order. A layout that sets openGraph: { siteName: 'Acme', locale: 'en_CA' } and a page that sets openGraph: { title: 'About' } do not combine: the page's openGraph object replaces the layout's whole object, so siteName and locale disappear from the output. Paste the layout object into the parent box and the page object into the main box to see exactly that. The fix is to repeat the fields you still need in the page, or to read the parent's values in generateMetadata.

metadataBase and relative URLs

With metadataBase: new URL('https://acme.com') in the root layout, alternates: { canonical: '/about' } becomes https://acme.com/about. The docs describe metadataBase as a convenience for fields that need fully qualified URLs, typically set once in the root layout. Without it, relative values for those fields are an error, which the previewer flags.

Common mistakes

What this tool does not cover

It does not execute code, fetch data, render file-based metadata, or confirm what a deployed page serves. A match here means the object produces the head output the Next.js documentation shows for it; search engines still choose their own titles and snippets. After deploy, view the live HTML with the Meta Tag Analyzer, and check the share cards with the Social Preview Checker. For non-Next.js sites, the Meta Tag Generator writes plain HTML tags.