Download the PHP package turbine-kreuzberg/spryker-sitemap without Composer
On this page you can find all versions of the php package turbine-kreuzberg/spryker-sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download turbine-kreuzberg/spryker-sitemap
More information about turbine-kreuzberg/spryker-sitemap
Files in turbine-kreuzberg/spryker-sitemap
Package spryker-sitemap
Short Description Sitemap module for Spryker shop
License MIT
Informations about the package spryker-sitemap
spryker-sitemap
Module generates sitemap according to the sitemap protocol.
Installation
composer require turbine-kreuzberg/spryker-sitemap
Setup
To use the provided console commands you will need to register TurbineKreuzberg namespace in your config_default.php.
In ConsoleDependencyProvider you need to add Sitemap consoles that you want to use.
If everything is working properly you should see sitemap section in your
You do not need to register index console if you have only one plugin and you are generating a single sitemap.
Usage
To generate sitemaps for all of your registered plugins you need to run:
if you want to generate sitemap for a single sitemap plugin instead of all of them you can use sitemap:generate with a plugin name. Typical use case is when you have different update frequencies for different sitemaps.
To generate sitemap index you need to run:
Generation of index will assume that all the sitemaps for registered plugins are generated. For now there is no validation.
Sitemap plugins
In order for console commands to do anything you will need to register at least one sitemap plugin in SitemapDependencyProvider. Plugins need to implement
\TurbineKreuzberg\Zed\Sitemap\Dependency\Plugin\SitemapPluginInterface
Technical considerations
Sitemap generation can be resource intensive and that is why we can use generators to reduce the memory usage. ORMs should be avoided for bulk operations and Propel provides access to underline PDO and we can utilize PDOStatement::fetch to iterate through database records to save the memory.
Example plugin
In the CategorySitemapPlugin that will call url module to retrieve all the URLs for categories. You can find all the necessary changed in the project corresponding folders.
Configuration
Sitemap module comes with some configuration that you need to be aware of.
| Configuration | Description |
|---|---|
| PUBLIC_HOSTNAME | Hostname of your site (i.e. www.example.com) |
| INDEX_FILENAME | defaults to sitemap_index.xml |
| IS_SSL_ENABLED | to put https or http in urls (defaults to true) |
| SITEMAP_FOLDER_PATH | folder in which sitemaps are to be generated (defaults to /tmp) |
A word about sitemaps
Sitemap standard comes with some limitations that we need to consider. Probably most crucial is that you can have 50k links in one sitemap. If you have more than that you need to create sitemap index and multiple sitemaps. When you create your plugins you need to take that into account.
Sitemap index example
Testing
Checking for code style violations
Sniffing
vendor/bin/phpcs --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src
Fixing of automatically fixable errors
vendor/bin/phpcbf --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src
PHPStan
vendor/bin/phpstan
Running tests
vendor/bin/codecept build
vendor/bin/codecept run
All versions of spryker-sitemap with dependencies
ext-zlib Version *
ext-simplexml Version *