Bug #87442

Can't modify/overwrite og:image and twitter:image via TypoScript

Added by corbet dynie 6 months ago. Updated 3 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
SEO
Start date:
2019-01-15
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

It is not possible to overwrite the meta tags via TypoScript.
So you can not create a TypoScript fallback with the media resources.

'page.meta.og:image' has no impact.
'page.meta.twitter:image' can be set and will be overwritten, if you set an image with page settings (twitter_image).
But not the other way round.

History

#1 Updated by Richard Haeser 5 months ago

  • Status changed from New to Needs Feedback

Hi,

did you check https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/MetaTagApi/Index.html#typoscript-and-php? Did you try the replace?

In my installation this is working fine.

#2 Updated by corbet dynie 5 months ago

First thanks for the reply.
The repace property will only prioritize the replacing with a plugin.
You are not allowed to replace the values with typoscript.

For example you can use the .field property to create a fallback.
This works:

twitter:title.field = twitter_title // seo_title // title

But with "twitter:image" and "og:image" this will not work.
You are not allowed to change the cType.

For example, this does not work:

twitter:image = IMAGE
twitter:image {
    file {
        import.data = levelmedia:-1, slide
        treatIdAsReference = 1
        import.listNum = 0
    }
}


or
twitter:image.stdWrap.cObject = IMAGE
twitter:image.stdWrap.cObject {
    file {
        import.data = levelmedia:-1, slide
        treatIdAsReference = 1
        import.listNum = 0
    }
}

#3 Updated by Riccardo De Contardi 4 months ago

  • Status changed from Needs Feedback to New

#4 Updated by Riny van Tiggelen 3 months ago

  • Status changed from New to Needs Feedback

I have setup the following pages:
- Root page with a twitter card image and 1 image in the resources
- 1 Subpage without any images

I have tried out the following:

page.meta.twitter:image.cObject = IMG_RESOURCE
page.meta.twitter:image.cObject {
  file {
    import.data = levelmedia:-1, slide
    treatIdAsReference = 1
    import.listNum = 0
  }
}

On my homepage I see the twitter card image as twitter:image
On my subpage I see the resources-image from the homepage, as twitter:image

When I add a twitter card image to my subpage, that one is shown as twitter:image

When I add the following line:

page.meta.twitter:image.replace = 1

All the pages have the resources-image from the homepage.

What is exactly the preferred situation which is not possible at the moment?

#5 Updated by Benni Mack 3 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

Also available in: Atom PDF