-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sitemap): add sitemap generation command and configuration
Introduced a new command `sitemap:generate` to create a sitemap XML. Added necessary configurations for sitemap generation using the Spatie Laravel Sitemap package. Updated dependencies in composer to include required packages.
- Loading branch information
frederic moras
committed
Dec 31, 2024
1 parent
cce7f9c
commit e1f18b8
Showing
4 changed files
with
478 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Spatie\Sitemap\Sitemap; | ||
use Spatie\Sitemap\Tags\Url; | ||
|
||
class GenerateSitemap extends Command | ||
{ | ||
protected $signature = 'sitemap:generate'; | ||
protected $description = 'Générer le sitemap XML pour le site'; | ||
|
||
public function handle() | ||
{ | ||
Sitemap::create() | ||
->add(Url::create('/')->setPriority(1.0)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/portes-fenetres-chassis')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/chassis/kind/alu')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/chassis/kind/pvc')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/pergolas')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/porte-de-garage')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/products/moustiquaire')->setPriority(0.9)->setChangeFrequency('yearly')) | ||
->add(Url::create('/contact')->setPriority(0.8)->setChangeFrequency('yearly')) | ||
->writeToFile(public_path('sitemap.xml')); | ||
|
||
$this->info('Sitemap généré avec succès!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.