#96502ModifyUrlForCanonicalTagEvent Caching issue on dynamic detail pages?
Description
Hello,
i have to modify the canonical tag. I do this thru the ModifyUrlForCanonicalTagEvent.
But after cache it always keeps the canonical url from the first cached page. Maybe additionalHeaderData in general is affected.
Don’t know its a bug or i am using something wrong. The PageTitleGenerator works fine.
*services.yaml*
NS\MyExt\EventListener\CanonicalListener is called only once. Looks like route arguments below not respected in the cache hash?
services:
....
NS\MyExt\EventListener\CanonicalListener:
tags:
- name: event.listener
identifier: 'ns/myext/canonical'
after: 'cs-seo/canonical'
event: TYPO3\CMS\Seo\Event\ModifyUrlForCanonicalTagEvent
*Site config.yaml*
Looks like the my_ext_item_slug argument will not respected in the page cache hash?
This probably where the problem is. But why?
(I am using the Simple type because the data are fetched from an remote rest api)
routeEnhancers:
MyExtItemDetail:
type: Simple
limitToPages:
- 1047
routePath: '/{my_ext_item_slug}'
requirements:
my_ext_item_slug: '^$|[a-zA-Z0-9-].*'
_arguments:
my_ext_item_slug: my_ext_item_slugReviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 1
History 5
-
Reinhard Hiebl changed description <span data-processor="relativetime" data-value="2022-01-11T09:38:54+00:00" > 01/11/22, 09:38 </span>
-
Reinhard Hiebl changed description <span data-processor="relativetime" data-value="2022-01-11T09:39:25+00:00" > 01/11/22, 09:39 </span>
-
Oliver Hader changed category <span data-processor="relativetime" data-value="2022-01-12T08:21:21+00:00" > 01/12/22, 08:21 </span>
-
Benni Mack commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-11-09T15:59:20+00:00" > 11/09/26, 15:59 </span> -
Benni Mack changed Related to #95297 <span data-processor="relativetime" data-value="2026-11-09T15:59:26+00:00" > 11/09/26, 15:59 </span>
The page cache only varies by dynamic route arguments when a valid cHash is present. Your Simple enhancer has no aspects, so my_ext_item_slug is dynamic; if the detail URLs are called without cHash and $GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cacheHash’][‘enforceValidation’] is false (legacy default for upgraded installations, see Important-95297), all slugs share one cache entry — including the canonical tag. Generate the links via typolink (which adds the cHash) and set enforceValidation to true, or use a custom route aspect so the slug becomes a static route argument. Closing as this is not a bug in the canonical event.