Declare the sitemaps of every shop in robots.txt on multistore - #207
Open
ShaiMagal wants to merge 1 commit into
Open
Declare the sitemaps of every shop in robots.txt on multistore#207ShaiMagal wants to merge 1 commit into
ShaiMagal wants to merge 1 commit into
Conversation
ShaiMagal
force-pushed
the
fix/robots-sitemap-multistore
branch
from
September 1, 2026 13:56
12a2eb7 to
f42d448
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
robots.txt is a single file in the shop root and multistore serves it to every domain, but the core writes a Sitemap line only for the shop in context (
Tools::generateRobotsFile()). The sitemaps of the remaining shops are then declared nowhere, and those shops are served a Sitemap line for a domain that is not theirs.What it does
Subscribes to
actionAdminMetaAfterWriteRobotsFile, which the core fires with the open file handle, and appends one Sitemap line per remaining shop using that shop's own domain and its ownPS_SSL_ENABLEDvalue. The shop in context is skipped because the core already wrote it, and only shops whose sitemap file exists and is non-empty are listed, same condition the core applies. It does nothing when multistore is off.The hook has to reach existing installations, hence the version bump and
upgrade-5.1.0.php.How to test
Before:
After:
Multiple Sitemap lines are allowed, so each domain now finds its own. Worth checking that a single-shop install produces a byte-identical file to before, and that a shop with no generated sitemap is not listed.