No description
Find a file
Noix 9a6bc344a5 Merge branch '7.1.0-nullable-relation' into 'develop'
feat: ✨ Added the possibility to get models with nullable relations

See merge request ldc-web/projets/sitemap-generator!6
2026-06-23 10:43:35 +00:00
config feat: ✨ Added the possibility to get models with nullable relations 2026-06-23 11:54:47 +02:00
routes feat: Change file location to handle k8s restart 2024-09-25 16:54:26 +02:00
src feat: ✨ Added the possibility to get models with nullable relations 2026-06-23 11:54:47 +02:00
.editorconfig First workin version without headleass chrome config 2023-08-10 14:48:45 +02:00
.gitignore First workin version without headleass chrome config 2023-08-10 14:48:45 +02:00
.gitlab-ci.yml Add gitlab CI file 2023-08-11 11:31:55 +02:00
.styleci.yml First workin version without headleass chrome config 2023-08-10 14:48:45 +02:00
CHANGELOG.md feat: ✨ Added the possibility to get models with nullable relations 2026-06-23 11:54:47 +02:00
composer.json feat: ✨ Added the possibility to get models with nullable relations 2026-06-23 11:54:47 +02:00
composer.lock feat: ✨ Added laravel 13 compatibility 2026-04-16 11:24:02 +02:00
phpcs.xml feat: ✨ Added laravel 13 compatibility 2026-04-16 11:24:02 +02:00
README.md chore: 🔖 release v5.0.1 2025-07-18 16:44:17 +02:00

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

  1. php artisan vendor:publish --tag=sitemap-generator

  2. Change configuration in config/sitemap-generator.php

  3. 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.