- 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
The following paths are considered
- {$storeLocales}/sitemap_{number}.xml
- {$storeLocales}/sitemap.xml
- sitemap_{number}.xml
- sitemap.xml