spatie/laravel-sitemap
Generate XML sitemaps for Laravel automatically by crawling your site or building them manually. Add URLs, models, lastmod/changefreq/priority, images and alternates, then write to file or disk. Supports sitemap index and large sites.
/en, /es) for global audiences, aligning with Google’s hreflang guidelines.spatie/laravel-sitemap extensions or custom tags)./posts/{slug}) that change frequently, making manual sitemaps impractical.django-sitemap, Ruby on Rails’ sitemap_generator)."This package automates our sitemap generation—critical for SEO and search visibility—so we don’t have to manually update XML files every time we add new content. Think of it like a ‘set it and forget it’ tool for Google’s crawlers. For example:
- Blogs/Publishers: Ensures every article is indexed by Google News automatically.
- E-commerce: Dynamically updates product pages as inventory changes.
- Multilingual Sites: Adds language tags (e.g.,
/en,/es) with zero extra work. It’s a low-cost, high-impact fix for a common technical debt problem. The team can deploy it in hours, not weeks."
"spatie/laravel-sitemap solves the ‘sitemap maintenance tax’ for Laravel apps by:
- Crawling your site (configurable depth/concurrency) to auto-discover routes, reducing manual work.
- Supporting advanced tags (hreflang, news, images) out of the box—no need to build custom XML logic.
- Integrating seamlessly with Laravel’s ecosystem (e.g.,
Sitemapableinterface for Eloquent models, scheduled commands).- Avoiding vendor lock-in: MIT-licensed, well-documented, and extensible (e.g., filter URLs, customize crawler behavior).
Tradeoffs:
- Crawling large sites may require tuning (e.g.,
setMaximumCrawlCount,setConcurrency).- JavaScript-heavy sites need
spatie/browsershotfor dynamic content (adds ~50MB dependency).Alternatives considered:
- Custom solution: 2–3 dev days to build; higher maintenance.
- Third-party SaaS: Monthly costs; less control over sitemap structure.
Recommendation: Pilot on a non-critical section (e.g., blog) to validate crawl accuracy before full rollout."
Key Metric to Track Post-Implementation:
How can I help you explore Laravel packages today?