Robots-Meta-Steuerung für Shop-Seiten (#22) #65

Merged
csaeum merged 2 commits from feature/robots-meta into main 2026-09-20 08:14:46 +00:00
Owner

Summary

  • Adds RobotsResolver/RobotsDirective (src/Seo/) resolving the <meta name="robots"> value for product, variant and category pages through three levels: an optional Sylius product attribute (wsc_seo_robots) for the main product, an optional per-webspace global default (robots_default), and a built-in fallback (index,follow for the product, noindex,follow for a variant address since it already carries a canonical to the main product).
  • A variant has no attribute of its own in Sylius, so the main-product override applies to both the product page and every one of its variant addresses — a deliberate deviation from the three-level template (wsc_swplugin_aiseotools, module 3), documented in docs/architecture.md.
  • A narrowed category listing (ListingQuery::isNarrowed()) stays noindex,follow regardless of any configured default.
  • The resolved value is always rendered explicitly, even index,follow — an absent tag means the same thing per browser default, but not every crawler reads that reliably as a deliberate choice.
  • Closes #22.

Test plan

  • RobotsResolverTest (11 cases covering every level and combination)
  • ProductPageRenderTest extended with 3 real-template cases (built-in default, built-in variant default, main-product override applied to both product and variant address)
  • BundleConfigurationTest updated for the new robots_default config key
  • 430 tests green, php-cs-fixer and PHPStan level 8 clean
  • Verified live in DDEV: product page (index,follow), variant address (noindex,follow), unnarrowed/narrowed category listing, and the global robots_default override
  • Not verified live: the wsc_seo_robots product-attribute override itself (would require creating the attribute in the Sylius admin) — covered by mocked unit/render tests only

🤖 Generated with Claude Code

## Summary - Adds `RobotsResolver`/`RobotsDirective` (`src/Seo/`) resolving the `<meta name="robots">` value for product, variant and category pages through three levels: an optional Sylius product attribute (`wsc_seo_robots`) for the main product, an optional per-webspace global default (`robots_default`), and a built-in fallback (`index,follow` for the product, `noindex,follow` for a variant address since it already carries a canonical to the main product). - A variant has no attribute of its own in Sylius, so the main-product override applies to both the product page and every one of its variant addresses — a deliberate deviation from the three-level template (`wsc_swplugin_aiseotools`, module 3), documented in `docs/architecture.md`. - A narrowed category listing (`ListingQuery::isNarrowed()`) stays `noindex,follow` regardless of any configured default. - The resolved value is always rendered explicitly, even `index,follow` — an absent tag means the same thing per browser default, but not every crawler reads that reliably as a deliberate choice. - Closes #22. ## Test plan - [x] `RobotsResolverTest` (11 cases covering every level and combination) - [x] `ProductPageRenderTest` extended with 3 real-template cases (built-in default, built-in variant default, main-product override applied to both product and variant address) - [x] `BundleConfigurationTest` updated for the new `robots_default` config key - [x] 430 tests green, php-cs-fixer and PHPStan level 8 clean - [x] Verified live in DDEV: product page (`index,follow`), variant address (`noindex,follow`), unnarrowed/narrowed category listing, and the global `robots_default` override - [ ] Not verified live: the `wsc_seo_robots` product-attribute override itself (would require creating the attribute in the Sylius admin) — covered by mocked unit/render tests only 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Three levels, mirroring wsc_swplugin_aiseotools module 3: an optional
Sylius product attribute (wsc_seo_robots) for the main product, an
optional per-webspace global default, and a built-in fallback
(index,follow for the product, noindex,follow for a variant address
since it already has a canonical to the main product). A variant has
no attribute of its own in Sylius, so the main-product override
applies to both the product page and every one of its variant
addresses.

A narrowed category listing stays noindex,follow regardless of any
configured default, matching the existing isNarrowed() rationale.

The resolved value is always rendered explicitly, even index,follow:
an absent tag means the same thing per browser default, but not every
crawler reads that reliably as a deliberate choice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
docs(shop-seo): describe robots meta tag levels and fallback for #22
All checks were successful
CI / cs-check (push) Successful in 22s
CI / phpstan (push) Successful in 38s
CI / phpunit (push) Successful in 33s
CI / build-release (push) Has been skipped
46ddec7199
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
csaeum merged commit 504bad3152 into main 2026-09-20 08:14:46 +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!65
No description provided.