Bug #106168
openNot possible to set "robots" and "canonical_link" from uncached plugins
0%
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
Updated by Jan Kornblum about 1 month ago
- Related to Feature #101388: Add possibility to modify "canonical" tag even from within uncached extbase controller action added
Updated by Oliver Hader 26 days ago
The call flow in \TYPO3\CMS\Frontend\Http\RequestHandler::handle
:
generatePageContent()
- calls
processHtmlBasedRenderingSettings()
- invokes
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']
- invokes
- calls
generatePageContent()
is called before$controller->isINTincScript()
That's why uncached actions don't have any effect, since the meta-tag content has been processed already.
Updated by Jan Kornblum 25 days ago
· Edited
Okay. But for example Page Title API can be used even from an uncached scope. Shouldn’t we have the same behavior for Meta Tag API?