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);
}
Change log
Please see the changelog for more information on what has changed recently.
Security
If you discover any security related issues, please email equipe.web@ldc.fr instead of using the issue tracker.