We run Saluvo , a health information site and app that is written in 80+ languages. The marketing pages, lab test explainers, symptom guides and blog posts each exist in many of those languages, which adds up to about 3,900 URLs.
A few weeks in, our sitemap.xml was 25 MB . Google's limit for a single sitemap is 50 MB uncompressed (and 50,000 URLs), so we were halfway to the ceiling with only a few thousand pages. Today the same sitemap lists 3,920 URLs in about 1 MB , and hreflang still works. Here's what happened and what we changed.
How a sitemap grows quadratically
Next.js (App Router) lets you return the sitemap as data from app/sitemap.ts , including language alternates for each URL. We used it the obvious way:
// app/sitemap.ts (before) export default function sitemap ( ) : MetadataRoute . Sitemap { return PAGES . flatMap ( ( path ) => LOCALES . map ( ( locale ) => ( { url : `${SITE}/${locale}${path}` , alternates : { languages : { . . . Object . fromEntries ( LOCALES .…