XML Sitemap: Troubleshooting and FAQ
Troubleshooting the XML sitemap in Sylius 2: 404 on fetch, per-channel error messages, files gone after deployment, missing products, hreflang, known limitations and FAQ.
XML Sitemap: Troubleshooting and FAQ
This documentation always describes the latest published version.
Troubleshooting
/sitemap-index.xml returns 404
Symptom: Requesting /sitemap-index.xml or /sitemap.xml ends with 404.
Check:
- Under MMKreativ Plugins → XML sitemap in the admin, is there a row for the channel, and is "Enable the sitemap for this channel" ticked?
- Has it been generated? The grid shows a time under "Last generated", otherwise there are no files.
- Does the host belong to an enabled channel? Serving uses the channel Sylius resolves for the host.
- Are the shop routes imported at the top level, not under
/{_locale}?bin/console mmd:sitemap:setupreports missing imports.
Solution: Complete the missing steps, then run bin/console mmd:sitemap:generate.
Generation reports an error for a channel
Symptom: The command or the button reports an error per channel while the other channels run through.
| Message (roughly) | Cause | Solution |
|---|---|---|
| Channel has no sitemap settings yet | No row created in the admin | Create a row for the channel |
| The sitemap is disabled for the channel | Master switch off | Tick "Enable the sitemap for this channel" |
| Channel does not exist | The setting's channel code matches no channel | Correct or delete the setting |
| Channel is disabled in Sylius | Sylius only resolves enabled channels by host | Enable the channel in Sylius |
| Channel has no hostname | Without a host no absolute URLs can be built | Set the hostname on the channel |
| Channel has no default locale | The default locale is missing on the channel | Set the default locale |
| Already being generated by another process | A generation for this channel is already running | Wait until it finishes |
| Generating the sitemap failed: … | For example an unwritable directory, a missing route import or a database error | Fix the reason given in the message |
Files are gone after a deployment
Symptom: After a deployment the sitemap returns 404 although it worked before.
Check: Is storage_dir (default var/sitemap) inside a directory that is recreated on deploy?
Solution: Put storage_dir on persistent storage, or run bin/console mmd:sitemap:generate right after the deployment. The directory must be writable for the executing user and readable for the web server user.
Menu entry is missing in the admin
Symptom: No "XML sitemap" entry appears under "MMKreativ Plugins".
Check: Is the plugin's config/routes/admin.yaml imported?
Solution: Add the import (see Installation). Without the route the plugin hides the entry instead of breaking the sidebar of every admin page.
Migration aborts
Symptom: mmd:sitemap:setup or the migration reports that it is written for MySQL 8 and MariaDB only.
Cause: The plugin supports only MySQL and MariaDB. On any other platform the migration aborts deliberately.
Solution: Do not install the plugin on another database.
Setup command asks for the Sylius migrations first
Symptom: The command stops with a note that migrations this plugin builds on are still open.
Solution: Run bin/console doctrine:migrations:migrate first, then bin/console mmd:sitemap:setup again.
A product or category is missing
| What is missing | Possible cause |
|---|---|
| Product | Disabled, not assigned to the channel, or without a slug in the language. It only appears in languages it has a slug for |
| Category | The taxon or a parent taxon is disabled, it lies outside the channel's menu taxon, or it is a tree root |
| Static page | The route is not in static_routes, has mandatory parameters, or "Static pages" is switched off |
| Images | "Product images" is switched off or the product has no images |
Hreflang is missing
Check: Is "Hreflang alternates" switched on, does the channel have more than one language, and do the shop routes contain the {_locale} placeholder?
Cause: Without distinct URLs per language there is nothing to link, so no hreflang appears.
Known limitations
- Sylius has no CMS pages and no manufacturers, so there are no built-in providers for them. Add them with a custom provider.
- Only MySQL and MariaDB are supported.
- Files are served uncompressed. Let the web server compress the response.
- A response is only publicly cacheable when no session was started for the request.
- Duplicate URLs are detected with a 60-bit hash per URL (about 40 bytes each). That is roughly 40 MB of PHP memory per million URLs, plus one file's worth of buffer that is streamed to a temporary file.
- Only products are read in batches. The plugin loads the categories in a single query, which is uncritical for typical category trees.
- Change frequency and priority apply to the whole content type of a channel, not per product or category.
- Products are filtered only by "enabled" and channel assignment. Stock, availability window and variant prices play no role.
- The batch size when reading products (500) and the cache lifetime of serving (one hour) are not configurable.
FAQ
General
Is the sitemap updated on every catalog change? No. It is only produced by the command or the button. Schedule the command as a cron job.
Do I have to submit the sitemap to Google? Add the index URL to your robots.txt or submit it in the Search Console.
Configuration
Can I set priority and change frequency per product? No, only per content type and channel.
Why can't I change the channel of a setting any more? So that files already generated are not orphaned. Create a new row for another channel.
Compatibility
Does the plugin work headless? Yes, serving is independent of the frontend as long as /sitemap-index.xml reaches Sylius.
Is there a Twig function for robots.txt? No. You add the index URL yourself.