Markus Michalski FAQ

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.

Deutsche Version

Back to overview

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:

  1. Under MMKreativ Plugins → XML sitemap in the admin, is there a row for the channel, and is "Enable the sitemap for this channel" ticked?
  2. Has it been generated? The grid shows a time under "Last generated", otherwise there are no files.
  3. Does the host belong to an enabled channel? Serving uses the channel Sylius resolves for the host.
  4. Are the shop routes imported at the top level, not under /{_locale}? bin/console mmd:sitemap:setup reports 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

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.