
How I Got 960 Pages Indexed with Next.js Segmented Sitemaps
If you're building a large Next.js site with hundreds of pages, a single sitemap can actually hurt your indexation rate. Here's how I fixed it. The Problem My site ToolKit Online has 155+ tools × 6 languages = ~960 pages. With a single sitemap.xml , Google was only indexing 7% of my pages after months. Why? Google allocates a limited "crawl budget" to new domains. When it sees 960 URLs in one sitemap, it cherry-picks a few and ignores the rest. The Fix: generateSitemaps() Next.js 13+ (App Router) supports generateSitemaps() to split your sitemap into a sitemap index with multiple child sitemaps. // app/sitemap.ts import type { MetadataRoute } from ' next ' ; const categories = [ ' finance ' , ' text ' , ' health ' , ' dev ' , ' math ' , ' images ' ]; export async function generateSitemaps () { return [ { id : ' static ' }, ... categories . map (( cat ) => ({ id : cat })), { id : ' blog ' }, ]; } export default function sitemap ({ id }: { id : string }): MetadataRoute . Sitemap { if ( i
Continue reading on Dev.to Webdev
Opens in a new tab




