feat(sitemap): Ajoute une commande pour générer les sitemaps et modifie l'appel dans ansible.
```
This commit is contained in:
Serreau Jovann
2026-01-20 18:38:20 +01:00
parent 2434243d02
commit a56b1e51b8
3 changed files with 38 additions and 2 deletions

View File

@@ -216,7 +216,7 @@
args: args:
chdir: "{{ path }}" chdir: "{{ path }}"
- name: Exécuter pwa:compile dans le répertoire de l application - name: Exécuter pwa:compile dans le répertoire de l application
ansible.builtin.command: php bin/console presta:sitemaps:dump ansible.builtin.command: php bin/console app:sitemap
become: false become: false
args: args:
chdir: "{{ path }}" chdir: "{{ path }}"

View File

@@ -6,7 +6,11 @@ controllers:
type: attribute type: attribute
PrestaSitemapBundle_section:
path: "/seo/%presta_sitemap.sitemap_file_prefix%.{name}.{_format}"
defaults: { _controller: Presta\SitemapBundle\Controller\SitemapController::sectionAction }
requirements:
_format: xml
2fa_login: 2fa_login:
path: /2fa path: /2fa

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App\Command;
use Presta\SitemapBundle\Service\DumperInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\RouterInterface;
#[AsCommand(name: 'app:sitemap', description: 'Dumps sitemaps to given location')]
class SitemapCommand extends Command
{
public function __construct(private readonly KernelInterface $kernel,private readonly DumperInterface $dumper,?string $name = null)
{
parent::__construct($name);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->dumper->dump($this->kernel->getProjectDir()."/public/seo",$_ENV['DEFAULT_URI']."/seo","",[]);
return Command::SUCCESS;
}
}