DEV Community

MAX REED
MAX REED

Posted on

Next.js 15 Sitemap built-in vs Custom

I am confused until i know that which is good for what untile i read this
Next.js 15 introduces a built-in sitemap.ts feature that makes generating sitemaps easier, typed, and fully integrated with robots.txt. Developers can define routes, add metadata like lastModified, and even split large sitemaps automatically with generateSitemaps(). This works great for blogs, docs, and most sites.

However, if your project needs custom XML structures (e.g., Google News tags, multi-domain indexes, or special namespaces), you can instead build a manual sitemap using a custom Route Handler at sitemap.xml. This gives you complete control but requires more code and maintenance.

πŸ‘‰ In short:

Use built-in sitemap.ts for 90% of cases β€” fast, typed, SEO-ready.

Go custom XML if you need non-standard extensions or advanced control.

Read the full guide here: Learn Pro Sitemap in Next.js 15 β€” Built-in vs XML

Question β†’ Use Built-In app/sitemap.ts β†’ Use Custom sitemap.xml Route Handler
Need only standard sitemap functionality? Yes β€” go with built-in No β€” choose custom
Need images, videos, alternates support? Yes β€” built-in handles it You can implement manually
Need rare XML extensions (e.g., News tags)? No β€” built-in is limited Yes β€” custom gives full control
Dealing with a massive catalog? Use generateSitemaps() to split Use custom, possibly with manual split logic
Need ISR for periodic regeneration? Both support it (via revalidate) Both support it

Top comments (0)