Project

General

Profile

Actions

Bug #106168

open

Not possible to set "robots" and "canonical_link" from uncached plugins

Added by Jan Kornblum about 1 month ago. Updated 25 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
SEO
Target version:
-
Start date:
2025-02-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #101388: Add possibility to modify "canonical" tag even from within uncached extbase controller actionNew2023-07-19

Actions
Actions #1

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
Actions #2

Updated by Oliver Hader 26 days ago

https://github.com/TYPO3/typo3/blob/d6bb232f7878d79e1ea51e9c830db627d5148218/typo3/sysext/frontend/Classes/Http/RequestHandler.php#L137

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']
  • 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.

Actions #3

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?

Actions

Also available in: Atom PDF