Skip to content
2.17Beginner5 min

XML Sitemaps: Best Practices for Large Websites

Lucas Blochberger··Updated 20 April 2026
Definition

XML Sitemaps are machine-readable lists of all indexable URLs. In Next.js 15, the sitemap.ts file convention replaces third-party plugins and enables dynamic generation from CMS data.

Key Takeaways

  • Maximum 50,000 URLs or 50MB per sitemap file
  • Only update lastmod when content actually changes
  • Only include indexable URLs (no noindex, no 404)
  • Sitemap index for more than 50,000 URLs
  • In Next.js: sitemap.ts file convention with ISR revalidation
  • Hreflang in sitemaps for international sites

XML Sitemaps are a cornerstone of technical SEO — especially for large websites with dynamic content.

Limits and Format

Maximum 50,000 URLs or 50MB per sitemap file. For larger sites: sitemap index with references to individual sitemaps. Set lastmod only when content actually changes — automatic daily updates without changes dilute the signal.

Next.js Implementation

The sitemap.ts file convention in Next.js App Router replaces third-party plugins and enables dynamic generation from Payload CMS data with ISR revalidation.

A sitemap is like a roadmap for search engines. It helps them discover pages that might not be found through normal crawling.

Gary Illyes, Google Search Analyst

FAQ

Should images and videos be in the sitemap?
Yes, separate image and video sitemaps for websites with many media files. Google recommends image sitemaps for better image search indexing.