Bug #89165

Metatags set with metatag manager registry wont be rendered if a plugin action is uncached

Added by Daniel Dorndorf 3 months ago. Updated about 1 month ago.

Needs Feedback
Should have
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


I got the issue that the meta tags I set via the new meta tag api in my controller were not set.

There seems to be an Issue when the action is uncached and a proper instantiating of the page renderer using the added metatags etc.

I wasn't able to find out more details yet, I may edit this later, but maybe this gives someone a direction to the location of the problem.



#1 Updated by Michael Stucki 3 months ago

  • Project changed from forge.typo3.org to TYPO3 Core
  • TYPO3 Version set to 10

Wrong project.

#2 Updated by Christian Eßl 2 months ago

  • Category set to SEO

#3 Updated by Richard Haeser about 2 months ago

Hi Daniel,

In my own setup I don't have any problems with this. So I do have some questions for you:

- Which version of TYPO3 do you use?
- Do you have a snippet of the code that is setting your metatag by the API?
- Is it a metatag that is also set by other plugins or by page settings?



#4 Updated by Richard Haeser about 2 months ago

  • Status changed from New to Needs Feedback

#5 Updated by Daniel Dorndorf about 2 months ago

Hi Richard,

I'm using TYPO3 9.5.10

I created a MetaTagService which gets the MetaTagManagerRegistry via inject method (but I also tried it manually with the ObjectManager):

 * @var \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry
protected $metaTagManagerRegistry;

 * @param \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry $metaTagManagerRegistry
public function injectMetaTagManagerRegistry(MetaTagManagerRegistry $metaTagManagerRegistry)
    $this->metaTagManagerRegistry = $metaTagManagerRegistry;

Example for "description"-Tag:

$this->metaTagManagerRegistry->getManagerForProperty('description')->addProperty('description', $description, [], true);

In an uncached action the MetaTagManagers properties in the page renderer wont be replaced, the value set by the page settings will be used.
For me it seems like something with the singleton instance isn't working properly, because in my understanding the MetaTagManagerRegistry in the PageRenderer and in my service should be the same object, but they are not.


#6 Updated by Richard Haeser about 2 months ago

Can you try it like:

        $metaTagManagerRegistry = GeneralUtility::makeInstance(MetaTagManagerRegistry::class);

        $ogMetaTagManager = $metaTagManagerRegistry->getManagerForProperty('og:title');
        $ogMetaTagManager->addProperty('og:title', 'Entry from uncached plugin', [], true);

This works for me even on mixed pages. On mixed pages the uncached plugin will always overrule the other cached data.

#7 Updated by Daniel Dorndorf about 2 months ago

It worked... but why?

Is there enough time or operations between calling the constructor and the action using the registry, that there's a difference?
(I also instanciated the registry via GeneralUtility but in the constructor)

Maybe I'm lacking knowledge about singleton instances and the core, or is there an issue deep down the rabbit hole?

#8 Updated by Richard Haeser about 2 months ago

Even with GeneralUtility you had this problem? Maybe something was wrong with the injection? Should work as far as I know.

#9 Updated by Daniel Dorndorf about 1 month ago

I have no hooks or anything special, just moved everything in a service class and used dependency injection

Also available in: Atom PDF