Introduction
XML sitemaps remain one of the most direct ways to communicate your site structure to search engines.
1. Use a Sitemap Index
For sites with more than 10,000 URLs, split your sitemap into logical child sitemaps and reference them from a sitemap index file.
2. Only Include Indexable URLs
Never include URLs with noindex directives, 301 redirects, 404 errors, or canonical mismatches in your sitemap.
3. Keep Lastmod Accurate
Update the lastmod tag only when the page content genuinely changes.
4. Stream Large Sitemaps
For programmatic sitemaps with hundreds of thousands of URLs, use a StreamedResponse in Laravel to write XML directly to the output buffer.
5. Submit to Google Search Console
Always submit your sitemap index URL in Google Search Console under Sitemaps.
Conclusion
A well-maintained sitemap is a low-effort, high-impact SEO hygiene task that every site should prioritise.