Next.js Sitemap Generator
Our Next.js Sitemap Generator crawls your deployed application to extract all rendered routes. Use it to verify your dynamic route generation or to create a static sitemap file for SSG builds.
How to Use This Tool
Enter Next.js URL
Analyze Site
Review URLs
Choose Output
Copy or Download
Recommended Action
How Next.js Handles Sitemaps
In the Next.js App Router, sitemaps are typically generated dynamically using a `sitemap.ts` file placed at the root of the `app/` directory. This file exports an async function that returns an array of URL objects.
If you are using the older Pages Router or building a completely static export (SSG), you often rely on external packages like `next-sitemap` run as a post-build script.
What BuildSitemap Checks
Because Next.js applications often combine static, server-rendered (SSR), and incremental static regeneration (ISR) routes, bugs in your `sitemap.ts` database queries can lead to missing URLs.
BuildSitemap acts as a black-box tester. We crawl the live production deployment, following your actual React Router `Link` components. This verifies if the URLs your `sitemap.ts` is outputting actually match the links users can access.
URLs We Discover
- Static App Router pages (/app/page.tsx)
- Dynamic routes (/app/[slug]/page.tsx)
- API endpoints (if accidentally linked)
- ISR generated pages
URLs to Exclude
- Route Handlers (/api/*) that do not return HTML
- Protected application states (/dashboard/*)
- Parameterized search URLs
- Error boundaries or suspense fallback states
Next.js Sitemap Structure
For large Next.js applications (like a headless ecommerce store or content portal), you must shard your sitemap in Next.js 13+.
Using our Structured Sitemap tool can help you identify exactly how to bucket your dynamic routes (e.g., separating `/blog/[slug]` from `/product/[id]`) so you can implement the `generateSitemaps` function efficiently in your Next.js codebase.
Common Next.js Problems
Returning more than 50,000 URLs from a single `sitemap.ts` file, causing Google to reject the file.
Failing to account for pagination in the database queries powering the dynamic sitemap generation.
Mismatch between the base URL in the sitemap (e.g., HTTP vs HTTPS) and the deployed environment.
How to Use Your Generated Sitemap
While you should ideally code a dynamic `sitemap.ts` for Next.js, our tool is incredibly useful for:
- Static Exports: If you are using `output: 'export'`, you can use our tool to generate a static XML file and drop it into your `public/` folder.
- Auditing: Compare the output of our external crawl against the output of your `/sitemap.xml` route to find missing database entries or orphaned pages.
Example Next.js Output
import { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://nextjs.example.com',
lastModified: new Date(),
},
{
url: 'https://nextjs.example.com/blog/app-router',
lastModified: new Date(),
},
]
}