Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.2 KB

README.md

File metadata and controls

43 lines (30 loc) · 1.2 KB

Sitemap Package for Laravel

forked from Laravelium/laravel-sitemap

Installation

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!

Usage

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');

License

This package is open-sourced software licensed under the MIT license.