What is XML Sitemap?
An XML sitemap is a file that lists all important URLs on your website, helping search engines discover and crawl your content efficiently. It acts as a roadmap of your site for search engine bots.
Best practices: - Include only canonical, indexable pages (no noindex, no redirects, no 4xx pages) - Add lastmod dates (helps crawlers prioritize recently updated content) - Set changefreq and priority values appropriately - Keep under 50,000 URLs per sitemap file (use sitemap index for larger sites) - Keep file size under 50MB uncompressed - Submit to Google Search Console and Bing Webmaster Tools - Reference in robots.txt with Sitemap: directive - Generate dynamically (don't maintain manually)
Types: - Standard XML sitemap: Lists page URLs - Image sitemap: Lists images for image search - Video sitemap: Lists videos for video search - News sitemap: For Google News publishers
Dynamic sitemap generation (like Next.js sitemap.ts) ensures new pages are automatically included.
Example
A blog publishing 3 posts per week with a static sitemap from 6 months ago is missing 78 posts from its sitemap. Google may not discover these posts for weeks. A dynamic sitemap.ts that auto-includes new posts fixes this.