Sitemap-Provider für Produkte und Kategorien (#23) #66

Merged
csaeum merged 2 commits from feature/sitemap-provider into main 2026-09-20 12:24:39 +00:00
Owner

Summary

  • Add ProductSitemapProvider (alias wsc_sylius_products) and TaxonSitemapProvider (alias wsc_sylius_taxons), registered under Sulu's sulu.sitemap.provider tag.
  • The product provider paginates against the shop API for real (only fetches the products a requested sitemap page actually needs); the taxon provider slices the already fully-loaded category tree. Variants never get their own entry — they canonical to the main product (#21).
  • Indexability reuses the existing RobotsResolver (#22) via a new RobotsDirective::isIndexable(), so sitemap, canonical and robots tag never contradict each other.
  • Addresses are built via ShopUrlGenerator::slugPath() rather than forProduct(..., ABSOLUTE_URL): the latter depends on Sulu's persisted route table, which only contains a shop address after it has been delivered once — a dead end for a sitemap whose whole point is announcing pages nobody has visited yet. Found live in DDEV; details in docs/architecture.md.
  • Known limitation: slugPath() carries no locale prefix, matching this project's single-locale webspaces today; a multi-locale webspace would need that revisited alongside #24.

Closes #23.

Test plan

  • composer cs-check — clean
  • composer phpstan (level 8) — clean
  • composer test — 444 tests green (new: SitemapWebspaceResolverTest, ProductSitemapProviderTest, TaxonSitemapProviderTest, each with a case spanning more than one sitemap page)
  • Verified live in DDEV: /sitemap.xml lists wsc_sylius_products-1.xml and wsc_sylius_taxons-1.xml; 176 resp. 20 addresses, spot-checked entries return 200 despite never having been visited before

🤖 Generated with Claude Code

## Summary - Add `ProductSitemapProvider` (alias `wsc_sylius_products`) and `TaxonSitemapProvider` (alias `wsc_sylius_taxons`), registered under Sulu's `sulu.sitemap.provider` tag. - The product provider paginates against the shop API for real (only fetches the products a requested sitemap page actually needs); the taxon provider slices the already fully-loaded category tree. Variants never get their own entry — they canonical to the main product (#21). - Indexability reuses the existing `RobotsResolver` (#22) via a new `RobotsDirective::isIndexable()`, so sitemap, canonical and robots tag never contradict each other. - Addresses are built via `ShopUrlGenerator::slugPath()` rather than `forProduct(..., ABSOLUTE_URL)`: the latter depends on Sulu's persisted route table, which only contains a shop address after it has been delivered once — a dead end for a sitemap whose whole point is announcing pages nobody has visited yet. Found live in DDEV; details in `docs/architecture.md`. - Known limitation: `slugPath()` carries no locale prefix, matching this project's single-locale webspaces today; a multi-locale webspace would need that revisited alongside #24. Closes #23. ## Test plan - [x] `composer cs-check` — clean - [x] `composer phpstan` (level 8) — clean - [x] `composer test` — 444 tests green (new: `SitemapWebspaceResolverTest`, `ProductSitemapProviderTest`, `TaxonSitemapProviderTest`, each with a case spanning more than one sitemap page) - [x] Verified live in DDEV: `/sitemap.xml` lists `wsc_sylius_products-1.xml` and `wsc_sylius_taxons-1.xml`; 176 resp. 20 addresses, spot-checked entries return `200` despite never having been visited before 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Register wsc_sylius_products and wsc_sylius_taxons sitemap providers.
The product provider paginates against the shop API for real instead
of loading the whole catalog; the taxon provider slices the already
fully-loaded category tree. Indexability reuses RobotsResolver (#22)
via the new RobotsDirective::isIndexable(), so sitemap, canonical and
robots tag never contradict each other.

Addresses are built via ShopUrlGenerator::slugPath() rather than
forProduct(..., ABSOLUTE_URL): the latter depends on Sulu's persisted
route table, which only contains a shop address after it has been
delivered once - useless for a sitemap that exists to announce pages
nobody has visited yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
docs(shop-seo): describe sitemap providers and slug-path url generation for #23
All checks were successful
CI / build-release (push) Has been skipped
CI / cs-check (push) Successful in 23s
CI / phpstan (push) Successful in 37s
CI / phpunit (push) Successful in 34s
a8cee2d800
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
csaeum merged commit 920d545809 into main 2026-09-20 12:24:39 +00:00
csaeum deleted branch feature/sitemap-provider 2026-09-20 12:24:39 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Sulu-Bundles/wsc_sulubundle_syliusheadless!66
No description provided.