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

Input: 6 static marketing pages + Prisma blog posts collection.
Calculated Result: Full TypeScript sitemap.ts mapping static routes and async database queries.

Automatically rebuilds and caches sitemaps according to Next.js route revalidation rules.

Example 2: E-Commerce Product & Category Sitemap

Input: Static landing pages + WooCommerce / Shopify / Prisma products catalog.
Calculated Result: Combined static and dynamic array with daily change frequency for active product listings.

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.

Web Developer Tools

Next.js Metadata Generator

The Next.js Metadata Generator creates production-grade, type-safe Next.js App Router metadata configurations,...

Launch Tool →
Web Developer Tools

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 ...

Launch Tool →
Technical SEO Tools

Sitemap URL Counter

The Sitemap URL Counter parses XML sitemaps and sitemap indexes, providing instant counts of indexable URLs, c...

Launch Tool →

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`).

Blueprint Grid Background
AVAILABLE FOR NEW CONTRACTS & ARCHITECTURAL BUILDS

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.

Direct Senior Architect Access
100% Code & IP Ownership
Milestone-Based Global Delivery