Skip to content

Commit 4984315

Browse files
committed
add command inspirecms:generate-sitemap
1 parent 2f27521 commit 4984315

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/Commands/GenerateSitemap.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace SolutionForest\InspireCms\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Symfony\Component\Console\Attribute\AsCommand;
7+
8+
9+
#[AsCommand(
10+
name: 'inspirecms:generate-sitemap',
11+
description: 'Generate a sitemap for the InspireCMS plugin'
12+
)]
13+
class GenerateSitemap extends Command
14+
{
15+
public function handle()
16+
{
17+
$this->info('Generating Sitemap...');
18+
19+
// Create the sitemap using the factory
20+
$sitemapGenerator = \SolutionForest\InspireCms\Factories\SitemapGeneratorFactory::create();
21+
$sitemapGenerator->generateSitemapFile();
22+
23+
$this->info('Sitemap generated successfully!');
24+
}
25+
}

src/InspireCmsServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ protected function getCommands(): array
213213
return [
214214
Commands\AboutCommand::class,
215215
Commands\CacheStats::class,
216+
Commands\GenerateSitemap::class,
216217
Commands\UpdatePluginCommand::class,
217218
Commands\PublishPanel::class,
218219
Commands\InstallRequirePacakges::class,

0 commit comments

Comments
 (0)