AVAILABLE FOR WEB, FLUTTER & QA PROJECTS
How to use this tool
1. Define Static Core Routes
List your primary application URLs (e.g. /, /about, /services, /pricing, /blog).
2. Configure Dynamic Collections
Specify dynamic database collections (e.g. Prisma `prisma.post.findMany()`, products, or categories).
3. Set Change Frequencies & Priorities
Assign appropriate frequencies (daily, weekly, monthly) and priority weights (0.1 to 1.0).
4. Copy app/sitemap.ts File
Paste the generated TypeScript file directly into your `src/app/sitemap.ts` file.
Formula or logic used
Next.js Sitemap Protocol & Type Safety
Next.js native sitemaps use `MetadataRoute.Sitemap` to return strongly-typed XML sitemap manifests without requiring custom XML serialization libraries.
Signature: `export default async function sitemap(): Promise<MetadataRoute.Sitemap>`URL Limit: Single sitemaps are capped at 50,000 URLs by XML standards. Next.js supports `generateSitemaps` for larger index splitting.Base URL Environment: Always source domain from `process.env.NEXT_PUBLIC_SITE_URL` for environment consistency.Priority Scale: Priorities range from 0.0 to 1.0 (Home: 1.0, Key Services: 0.9, Blog: 0.7-0.8, Policies: 0.3).
Examples
Example 1: Standard SaaS App Router Sitemap
Automatically rebuilds and caches sitemaps according to Next.js route revalidation rules.
Example 2: E-Commerce Product & Category Sitemap
Ensures newly added inventory is immediately indexable by search engine crawlers.
Common use cases
Automated Google Search Console Indexation
Serve dynamic `/sitemap.xml` automatically built from your live database.
Headless CMS to Next.js Sitemaps
Query Strapi, Contentful, or WordPress REST APIs inside `app/sitemap.ts`.
Eliminating 3rd-Party XML Generator Libraries
Replace bloated `next-sitemap` build scripts with native Next.js framework functionality.
Multi-Language International Sitemaps
Generate localized alternate links across multi-region Next.js routing structures.
Related tools
View All Tools Directory →Next.js Metadata Generator
The Next.js Metadata Generator creates production-grade, type-safe Next.js App Router metadata configurations,...
Next.js Robots.txt Generator
The Next.js Robots.txt Generator creates type-safe `app/robots.ts` files for the Next.js App Router, managing ...
Sitemap URL Counter
The Sitemap URL Counter parses XML sitemaps and sitemap indexes, providing instant counts of indexable URLs, c...
Frequently asked questions
Where should sitemap.ts be placed in Next.js App Router?
Place the file directly at `src/app/sitemap.ts` (or `app/sitemap.ts`). Next.js will automatically build and serve it at `/sitemap.xml`.
Can app/sitemap.ts be async?
Yes. `sitemap()` is natively async, allowing you to fetch dynamic slugs from Prisma, PostgreSQL, Supabase, or external CMS APIs.
How do I split sitemaps exceeding 50,000 URLs?
Use Next.js's built-in `generateSitemaps()` function in `app/sitemap.ts` to generate numbered sitemap IDs (e.g. `/sitemap/0.xml`, `/sitemap/1.xml`).
Does Next.js cache the generated sitemap?
Yes. In production builds, sitemaps are statically generated or cached according to route segment configuration (`export const revalidate = 3600`).
Let's build something
exceptional together
Work directly with Faisal Rafique to architect and deliver high-performance Next.js 15 platforms, 60fps Flutter mobile applications, and enterprise automated QA testing pipelines.