#106168Not possible to set "robots" and "canonical_link" from uncached plugins
Description
Currently it is not possible to manually set “robots” or “canonical_link” from uncached (extbase) plugins. The following does not work (when uncached):
$GLOBALS[‘TSFE’]->page[‘canonical_link’] = ‘Lorem ipsum dolor sit amet’
$GLOBALS[‘TSFE’]->page[‘robots’] = true;
$GLOBALS[‘TSFE’]->page[‘no_follow’] = true;
$GLOBALS[‘TSFE’]->page[‘no_index’] = true;
Also, when using the meta tag api it is not possible to set “robots” from an uncached scope (it just works for cached plugins):
$metaTagRegistry->getManagerForProperty(‘robots’)->addProperty(‘robots’, ‘noindex,nofollow);
So the only option to set “canonical_link” from an uncached scope is using the “ModifyUrlForCanonicalTagEvent” event, which is fine itself. But regarding the “robots”, the only solution seems to set it using typoscript (page.meta.robots = noindex,nofollow).
The core should be extended in the following way:
1. Add possibility to modify the “robots” tag using the meta tag api even when in uncached scope
2. Add possibility to modify the “canonical” directly ($GLOBALS[‘TSFE’]->page[‘canonical_link’], or anything else) even when in uncached scope
Reviews 1
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch
- Commit message
-
[BUGFIX] Not possible to set "robots" and "canonical_link" from uncached plugins Resolves: #106168 Releases: main