Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Sitemap Laravel Package

spatie/laravel-sitemap

Generate XML sitemaps for Laravel by crawling your site or building them manually. Add extra URLs, set last-modified dates, and include models via a simple interface. Write sitemaps to disk with a fluent, developer-friendly API.

View on GitHub
Deep Wiki
Context7

title: Splitting large sitemaps weight: 4

When you have a large number of URLs, you can automatically split them into multiple sitemap files with a sitemap index. Call the maxTagsPerSitemap method to set the maximum number of URLs per file.

When using the sitemap generator

use Spatie\Sitemap\SitemapGenerator;

SitemapGenerator::create('https://example.com')
    ->maxTagsPerSitemap(20000)
    ->writeToFile(public_path('sitemap.xml'));

When building a sitemap manually

This also works when building a sitemap manually. When the number of URLs exceeds the limit, writeToFile and writeToDisk will automatically create chunk files (sitemap_0.xml, sitemap_1.xml, ...) and write a sitemap index as the main file:

use Spatie\Sitemap\Sitemap;

Sitemap::create()
    ->maxTagsPerSitemap(20000)
    ->add(/* ... */)
    ->writeToFile(public_path('sitemap.xml'));

If the number of URLs is within the limit, a single sitemap file will be written as normal.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony