XML Sitemap
Extended XML sitemap for Sylius 2: products, categories and static pages with hreflang and product images, generated per channel via console command or admin button, with sitemap index and custom URL providers.
XML Sitemap
This documentation always describes the latest published version.
Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net
Overview
The plugin generates an extended XML sitemap for every Sylius channel: products, categories and freely selectable static pages, every language of the channel with its own URL and the complete hreflang set (including x-default), plus the product images as an image sitemap. The files are written ahead of time by a console command or an admin button and only served when requested.
A crawler hit never walks the catalog: the sitemap is generated ahead of time as files and only read on request. This holds for a Twig storefront and a headless frontend alike.
graph LR
A["Admin button Generate now"] --> C["Generation"]
B["Command mmd:sitemap:generate"] --> C
C --> D["Files per channel in storage_dir"]
D --> E["Request for sitemap-index.xml"]
E --> F["Crawler"]
Documentation
| Page | Content |
|---|---|
| Installation and operation | Installation via Packeton, bundle and routes, setup command, update, cron job, uninstallation |
| Configuration | Configuration keys, per-channel settings in the admin, practical examples |
| Generation and serving | Admin button, the mmd:sitemap:generate command, URLs, file splitting, sitemap content |
| Extending | Custom URL providers, replacing services, compatibility |
| Troubleshooting and FAQ | Common problems, known limitations, frequently asked questions |
| Technical details | Generation flow, plugin structure, storage layout, database table |
Features
| Feature | Description |
|---|---|
| Content types | Products, categories and static pages, each in its own file in the sitemap index |
| Hreflang | Every channel language gets its own URL with all language alternatives and x-default |
| Image sitemap | Product images per product URL; images stored on a CDN keep their own URL |
| Multiple channels | Own settings and own files per channel, served on the channel's host |
| Large catalogs | Products are read in batches, files are split at a configurable URL count and file size |
| Admin interface | Per-channel settings, a "Generate now" button, display of the last run |
| Console command | mmd:sitemap:generate for all or one channel, suited for cron jobs |
| Lock against double runs | Only one generation per channel runs at a time |
| Custom URLs | Any service implementing UrlProviderInterface adds more URLs, such as CMS pages or brands |
Requirements
| Requirement | Version | Notes |
|---|---|---|
| Sylius | ^2.2 | CI runs the test suite on Sylius 2.2 and 2.3 |
| PHP | ^8.3 | With the xmlwriter extension |
| Symfony | ^7.4 | As required by Sylius 2.x |
| Database | MySQL 8 or MariaDB | The migration deliberately aborts on any other platform. Tested against MySQL 8.4 |
| Composer package | mmd/sylius-sitemap-plugin |
Bundle class Mmd\SyliusSitemapPlugin\MmdSyliusSitemapPlugin |
License
Commercial license: one license covers one Sylius installation (all channels plus its development and staging environments). Redistribution is not permitted, and updates are included for 12 months from purchase.
Support
For questions about licensing, technical questions or bugs, reach me at support@markus-michalski.net.