What this prompt does
This prompt makes the AI add a complete SEO layer to a Next.js 15 App Router project, returning copy-ready code rather than pseudocode. You set the [route], the [base_url], the [og_image], and the [schema_type]. It produces generateMetadata per route (including the dynamic [route]), OpenGraph and Twitter Card tags using your default share image, JSON-LD for [schema_type] via the Script component, a dynamic sitemap.ts, a robots.ts, and canonical URLs built from [base_url].
The structure works because SEO breaks quietly when metadata and sitemaps drift apart, and a wrong canonical splits ranking across duplicate URLs. By generating all six pieces together and tying canonicals to [base_url], the prompt keeps them consistent from the first deploy. [route] shows how a dynamic page generates its metadata, [og_image] becomes the default share image, and [schema_type] (like BlogPosting) determines the JSON-LD shape so search engines and crawlers read the right structured data.
When to use it
- You're starting an App Router build and want the SEO layer wired from day one.
- You need
generateMetadatafor dynamic routes with title and description fallbacks. - You want OpenGraph and Twitter Card tags with a consistent default share image.
- You need JSON-LD structured data for a specific schema type.
- You want a dynamic
sitemap.tsand a sensiblerobots.tspointing at it. - You keep getting canonical URLs wrong and splitting ranking across duplicate paths.
Example output
You get each file fenced and copy-ready with a note on where it lives in the app directory: generateMetadata per route including the dynamic [route] with title/description fallbacks; OpenGraph and Twitter Card tags using [og_image] as the default share image; JSON-LD for [schema_type] injected via the Script component; a sitemap.ts that resolves static and dynamic routes from data; a robots.ts with allow/disallow rules pointing at the sitemap; and canonical URLs built from [base_url] so duplicate paths don't split ranking.
Pro tips
- Set
[base_url]to your real production domain — canonicals are built from it, and a wrong value silently splits ranking across duplicate URLs, which is the hardest issue to spot post-launch. - Match
[schema_type]to the page's actual content;BlogPostingandProductgenerate different JSON-LD, and the wrong type sends misleading structured data to crawlers. - Provide a real
[og_image]path that exists and is the right dimensions, since a missing share image produces broken link previews. - Use a representative
[route]so the dynamicgenerateMetadatapattern transfers cleanly to your other dynamic pages. - Verify the
sitemap.tsresolves your dynamic routes from the same data source your pages use, so the sitemap never lists URLs that 404. - Validate the generated JSON-LD in a structured-data testing tool before trusting it; small schema mistakes are easy to miss by eye.