No description
|
|
||
|---|---|---|
| config | ||
| routes | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .styleci.yml | ||
| CHANGELOG.md | ||
| composer.json | ||
| composer.lock | ||
| phpcs.xml | ||
| README.md | ||
Refresh Sitemap
Creates sitemap.xml and refresh using a config file
Handle i18n routes with codezero/laravel-localized-routes packages.
Installation
Via Composer
composer require uwil/sitemap-generator
Usage
-
php artisan vendor:publish --tag=sitemap-generator -
Change configuration in
config/sitemap-generator.php -
You can test your configuration using
php artisan sitemap:refresh --dry-run
Model implementation
Add :
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;
use Uwil\SitemapGenerator\Lib\SitemapHelper;
Model must implement :
implements Sitemapable
And an toSitemapTag method ex :
/**
* toSitemapTag method
*
* @return Url|string|array
*/
public function toSitemapTag(): Url | string | array
{
$model = $this->loadMissing('range');
$route = 'product.show';
$params = ['range' => $model->range, 'publishedProduct' => $model];
return SitemapHelper::generateUrl($route, $params, $model);
}
Security
If you discover any security related issues, please email equipe.web@ldc.fr instead of using the issue tracker.
Changelog
Latest version v5.0.1.
See the CHANGELOG.md file for details.
Copyright and License
Sitemap Generator was written by Uwil.
Copyright (c) 2023 and beyond Uwil.