forked from Laravelium/laravel-sitemap
You can install the package via composer:
composer require wish-cloud/laravel-sitemap
Then, publish needed assets (styles, views, config files):
php artisan vendor:publish --provider="WishCloud\LaravelSitemap\SitemapServiceProvider"
Note: Composer won't update them after composer update
, you'll need to do it manually!
Creating a new sitemap response is easy:
$sitemap = App::make('sitemap');
$sitemap->add('https://example.com/link1', Carbon::now(), '1.0', 'daily');
$sitemap->add('https://example.com/link2', '2022-02-17 13:26:37', '0.8', 'weekly');
return $sitemap->render('xml');
Create index files for large sitemaps:
$sitemap = App::make('sitemap');
$sitemap->addSitemap('https://example.com/sitemap-category.xml');
$sitemap->addSitemap('https://example.com/sitemap-product.xml');
$sitemap->addSitemap('https://example.com/sitemap-article.xml');
return $sitemap->render('sitemapindex');
This package is open-sourced software licensed under the MIT license.