-
Notifications
You must be signed in to change notification settings - Fork 351
Description
Q | A |
---|---|
Sulu Version | 2.6.6 |
PHP Version | 8.3 |
Actual Behavior
In case you have more than one webspace with a different host, the SitemapProviderPool will always return indices from the first loop result.
For example, suppose you have two webspaces:
- A (host: a.com) containing published pages and articles
- B (host: b.com) containing only published pages
When running the CLI command sulu:website:dump-sitemap, XML sitemap files will be generated for each webspace. The process correctly creates:
For webspace A: pages-1.xml, articles-1.xml
For webspace B: pages-1.xml
However, the issue occurs with the main sitemap.xml file. It is always duplicated from the first webspace in the loop.
For instance, if webspace A is processed first, then webspace B’s sitemap.xml will incorrectly be copied from A, but with the correct host (b.com). As a result, B’s sitemap.xml will reference b.com/pages-1.xml and b.com/articles-1.xml, even though articles-1.xml does not exist for webspace B.
Expected Behavior
Webspace A (a.com): sitemap.xml should reference pages-1.xml and articles-1.xml.
Webspace B (b.com): sitemap.xml should reference only pages-1.xml.
Steps to Reproduce
-
Define multiple webspaces with different hosts.
-
Ensure each webspace has different published entity types (e.g., one with pages and articles, another with only pages).
-
Run the command:
php bin/console sulu:website:dump-sitemap
-
Check the generated sitemap files for each webspace.
-
Observe that the sitemap.xml file for the second webspace is incorrect.
Possible Solutions
In the https://github.com/sulu/sulu/blob/2.6/src/Sulu/Bundle/WebsiteBundle/Sitemap/SitemapProviderPool.php remove property $index
and any related logic.