Introduction
XML sitemaps remain one of the most direct ways to communicate your site structure to search engines. Despite being a relatively simple technology, there are numerous best practices that separate well-optimised sitemaps from ineffective ones.
1. Use a Sitemap Index
For sites with more than 10,000 URLs, split your sitemap into logical child sitemaps (blog, products, locations) and reference them from a sitemap index file. This improves crawl efficiency and makes it easier to diagnose issues per section.
2. Only Include Indexable URLs
Never include URLs with noindex directives, 301 redirects, 404 errors, or canonical mismatches in your sitemap. This wastes crawl budget and sends mixed signals to Google.
3. Keep Lastmod Accurate
Update the lastmod tag only when the page content genuinely changes. Inflating lastmod to trick crawlers into re-visiting pages more frequently can erode trust and reduce crawl prioritisation.
4. Stream Large Sitemaps
For programmatic sitemaps with hundreds of thousands of URLs, use a StreamedResponse (in Laravel) or equivalent to write XML directly to the output buffer rather than collecting all URLs in memory first.
5. Submit to Google Search Console
Always submit your sitemap index URL in Google Search Console under Sitemaps. Monitor for errors and coverage issues daily.
6. Image and Video Sitemaps
Use sitemap extensions (image:image, video:video) to help Google discover media assets that may not be reachable through standard crawling.
Conclusion
A well-maintained sitemap is a low-effort, high-impact SEO hygiene task that every site should prioritise.