Project

General

Profile

Actions

Bug #98362

open

AbstractMetaTagManager: $replace is useless on metatags with "allowMultipleOccurrences" set

Added by Alexander Köberl about 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
SEO
Target version:
-
Start date:
2022-09-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
metatags og:image
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Tried to override metatags from page settings in a plugin on this page.
Failed on og:image, always both, the page og_image and the image from my plugin are rendered, even if $replace = true is set.

TYPO3 Versions 10 & 11

lines 117 and 150 in TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager
The code does not allow to replace metatags with "allowMultipleOccurrences" set

if ($replace === true) {
    $this->removeProperty($property, $type);
    $this->properties[$property][] = ['content' => $content, 'subProperties' => $subPropertiesArray];
    return;
}

if (isset($this->handledProperties[$property]['allowMultipleOccurrences']) &&
    (bool)$this->handledProperties[$property]['allowMultipleOccurrences']
) {
    $this->properties[$property][] = ['content' => $content, 'subProperties' => $subPropertiesArray];
}
Actions #1

Updated by Christoph Lehmann almost 2 years ago

Another example. On a EXT:news detail page i use

<n:metaTag name="title" content="superSpecial" />

and

page.meta.title.data = page:seo_title // page:title
page.meta.title.replace = 0 # Default

With this the meta tag occurs twice in markup.


I know, EXT:news has a register that could be used (register:newsTitle // page:seo_title // page:title), but with page.meta.title.replace=0 i expect only the meta title by the Fluid ViewHelper.

Actions

Also available in: Atom PDF