Skip to content

Sitemap bug with multiple webspaces #7756

@bober888

Description

@bober888
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

  1. Define multiple webspaces with different hosts.

  2. Ensure each webspace has different published entity types (e.g., one with pages and articles, another with only pages).

  3. Run the command:

php bin/console sulu:website:dump-sitemap

  1. Check the generated sitemap files for each webspace.

  2. 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.

Metadata

Metadata

Assignees

Labels

BugError or unexpected behavior of already existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions