Static route
- Next.js approach
- Export
metadata - Example
- About page with a fixed title and description
Set static or data-driven metadata in the App Router, compose title templates, and inspect the HTML Google receives.
In the Next.js App Router, export a metadata object from a layout.js or page.js file for static titles and descriptions. Use generateMetadata when the values depend on route data, such as a product or article slug. Set a title template in the layout, override it on individual pages, and inspect the rendered HTML to catch missing or duplicate values.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
layout.js or page.js export the metadata object. Put site-wide defaults and a title template in the root layout, then set page-specific fields where the content is known. Next.js shallowly merges metadata exported from multiple segments and replaces duplicate keys, so check the final output instead of assuming a child file inherits every nested parent field. A title template needs title.default, applies only to child segments, and does not apply to a page.js in the same segment as the layout that defines it; title.absolute ignores a parent template.metadatagenerateMetadata and read route datatitle.template in a layout and override route titlesProduct name | Storeimport type { Metadata } from "next"
export const metadata: Metadata = {
title: "Pricing | Example",
description: "Compare plans and choose the right setup for your team.",
}
export default function Page() {
return <main><h1>Pricing</h1></main>
}generateMetadata when metadata depends on route parameters, fetched content, or a parent segment. Fetch the same canonical content record the page uses to render its heading and body. If the record is missing, return the correct not-found behavior rather than emitting a generic title that suggests the page exists. The example uses Next.js 15 and later, where dynamic route params are asynchronous; Next.js 14 and earlier use a synchronous shape. Check the docs for your installed version before copying it.undefined does not turn into a blank or boilerplate tag.import type { Metadata } from "next"
export async function generateMetadata({
params,
}: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const { slug } = await params
const product = await getProduct(slug)
return {
title: `${product.name} | Example`,
description: product.searchSummary,
}
}Open a representative static and dynamic route. Check its <title>, description meta tag, H1, and canonical in the public HTML response.
Sample records with the shortest and longest names, a missing summary, and a non-default locale. Make sure every route has a distinct, accurate title and useful description.
Google generates title links from the title element, prominent headings, visible page text, and other sources. Align those sources when Google selects different wording.
Google primarily generates snippets from page content and may use your meta description when it better describes the page for the query. Make the first visible content answer the same intent.
For URL-level metadata, see Next.js canonical tags. For crawl discovery, see Next.js XML sitemaps and Google’s title link guidance.
3 questions people ask next, answered from the sources on this page.
In the App Router, export metadata with a description field from a layout.js or page.js. Use generateMetadata when the value depends on route data.
Use a layout for the shared title template and set a distinct title on pages that need one. Inspect the final rendered title after metadata is merged across layouts.
Check the deployed page HTML first, then compare the title with the visible heading and content. Google may generate another title link, and it has to recrawl and reprocess the page to notice changes, which Google says can take a few days to a few weeks.
Run the free audit, then approve the fixes. Every change can be undone.