valantic-spryker-shop / sitemap
Provides sitemap
1.0.0
2023-08-01 15:28 UTC
Requires
- php: >=7.4
- spryker/kernel: ^3.30.0
Requires (Dev)
- spryker-sdk/phpstan-spryker: ^0.4.0
- spryker/architecture-sniffer: ^0.5.7
- spryker/code-sniffer: ^0.17.18
- spryker/development: ^3.34
This package is auto-updated.
Last update: 2025-01-09 13:17:26 UTC
README
Implementation
- Install dependency
composer require valantic-spryker-shop/sitemap
- Register RouterPlugin
<?php namespace Pyz\Yves\Router; use [...] class RouterDependencyProvider extends SprykerRouterDependencyProvider { [...] /** * @return \Spryker\Yves\RouterExtension\Dependency\Plugin\RouteProviderPluginInterface[] */ protected function getRouteProvider(): array { return [ [...] new SitemapControllerProvider(), ]; } }
- Register Console command
<?php declare(strict_types = 1); namespace Pyz\Zed\Console; use [...] /** * @method \Pyz\Zed\Console\ConsoleConfig getConfig() */ class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider { [...] /** * @param \Spryker\Zed\Kernel\Container $container * * @return \Symfony\Component\Console\Command\Command[] */ protected function getConsoleCommands(Container $container) { $commands = [ [...] new SitemapGenerateConsole(), ]; } }
- Replace project name
- Add cronjob in current/config/Zed/cronjobs/jenkins.php
$jobs[] = [ 'name' => 'generate-sitemap-de', 'command' => '$PHP_BIN vendor/bin/console sitemap:generate de -vvv', 'schedule' => '0 0 1 1 *', 'enable' => false, 'run_on_non_production' => true, 'stores' => $allStores, ];
- Adjust config file
- Add sitemap constants with your locales
$config[SitemapConstants::SITEMAP_LOCALES] = [ 'ESA' => [ 'locales' => [ 'de' => 'de_CH', 'fr' => 'fr_CH', 'it' => 'it_CH', ] ] ]; $config[SitemapConstants::SITEMAP_URL_LIMIT] = 50; $config[SitemapConstants::SITEMAP_SIZE_LIMIT] = 100;
- Copy vendor template files into project folder
mkdir -p src/Pyz/Zed/Sitemap/Presentation
cp -r vendor/valantic-spryker/sitemap/src/ValanticSpryker/Zed/Sitemap/Presentation/* src/Pyz/Zed/Sitemap/Presentation
Access Sitemap
The following paths are considered
- {$storeLocales}/sitemap_{number}.xml
- {$storeLocales}/sitemap.xml
- sitemap_{number}.xml
- sitemap.xml