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.
You can install the package via composer:
composer require spatie/laravel-sitemap
The package will automatically register itself.
Optionally, you can publish the config file:
php artisan vendor:publish --provider="Spatie\Sitemap\SitemapServiceProvider" --tag=sitemap-config
This will copy the default config to config/sitemap.php where you can edit it.
use Spatie\Sitemap\Crawler\Profile;
return [
/*
* These options will be passed to GuzzleHttp\Client when it is created.
* They are merged with the crawler's defaults (cookies enabled,
* connect timeout 10s, request timeout 10s, redirects followed).
*
* For in-depth information on all options see the Guzzle docs:
*
* http://docs.guzzlephp.org/en/stable/request-options.html
*/
'guzzle_options' => [
],
/*
* The sitemap generator can execute JavaScript on each page so it will
* discover links that are generated by your JS scripts. This feature
* is powered by headless Chrome.
*
* You'll need to install spatie/browsershot to use this feature:
*
* composer require spatie/browsershot
*/
'execute_javascript' => false,
/*
* The package will make an educated guess as to where Google Chrome is installed.
* You can also manually pass its location here.
*/
'chrome_binary_path' => null,
/*
* The sitemap generator uses a CrawlProfile implementation to determine
* which urls should be crawled for the sitemap.
*/
'crawl_profile' => Profile::class,
];
How can I help you explore Laravel packages today?