Next.js SEO: Metadata, Sitemaps, and Structured Data
Next.js gives you everything you need for excellent SEO built in — you just have to use it. Here's the full checklist for the App Router.
The Metadata API
Export a `metadata` object (or an async `generateMetadata` function) from any page or layout to set the title, description, canonical URL, and social tags. Because it runs on the server, you can build titles and descriptions from your data — perfect for product and blog pages.
Dynamic sitemap and robots
Add a `sitemap.ts` that returns your URLs — including database-driven ones like products and posts — so new pages appear automatically. A `robots.ts` controls what crawlers can access and points them at your sitemap.
Don't forget these
- Set `metadataBase` so relative Open Graph image URLs resolve to absolute ones.
- Add a canonical URL to every page to avoid duplicate-content issues.
- Generate Open Graph images so links look good when shared.
- Keep noindex on private areas (account, admin, checkout).
Structured data (JSON-LD)
Emit JSON-LD for your Organization, Products, Articles, and breadcrumbs. Structured data helps Google understand your content and can unlock rich results — star ratings, breadcrumbs, and more — in search listings.
KitCraft templates ship with the full SEO stack — Metadata API usage, a dynamic sitemap and robots, Open Graph images, and JSON-LD schema — so your pages are search-ready out of the box.
