Bug #87625

MetaTagApi gives an Error in the Frontend when "og:image" is a stdWrap Value in TypoScript

Added by Julian Mair 6 months ago. Updated 3 months ago.

Status:
New
Priority:
Must have
Category:
SEO
Target version:
-
Start date:
2019-02-02
Due date:
% Done:

0%

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

Description

I have a problem with the MetaTag Api.
When I have in my TypoScript `og:image` lines, then i got this error in the frontend:

#1524209729 UnexpectedValueException: This MetaTagManager can't handle property "og:image:type" 

During my research i found out that the problem lies inside the `stdWrap` part of the `og:image` config (see below; the cObject Node).
When i remove the whole `cObject` Node and add something static like `og:image = /image.jpeg`, then it will work perfectly.

og:image {
    attribute = property
    cObject = FILES
    cObject {
        maxItems = 1
        references {
            table = pages
            uid.data = page:uid
            fieldName = media
        }
        # image from media field
        renderObj = TEXT
        renderObj {
            data = file:current:publicUrl
        }
        # fallback image if no media field was set
        stdWrap.ifEmpty.fallback = TEXT
        stdWrap.ifEmpty.fallback.value = /fallback.jpeg
    }
}
og:image:type = image/jpeg
og:image:type.attribute = property
og:image:width = 1280
og:image:width.attribute = property
og:image:height = 720
og:image:height.attribute = property

Side Note: this snippet worked perfectly in v8.7.*

diff.png View (114 KB) Julian Mair, 2019-02-03 15:14

History

#1 Updated by Richard Haeser 6 months ago

  • Status changed from New to Accepted
  • Assignee set to Richard Haeser
  • Priority changed from Should have to Must have

#2 Updated by Richard Haeser 6 months ago

  • Status changed from Accepted to Needs Feedback

Hi,

I checked the code in CMS8 and 9. And the submitted code is not working in CMS8 either. The issue is within the fallback part.

It should be:

stdWrap.ifEmpty.cObject = TEXT
stdWrap.ifEmpty.cObject.value = /fallback.jpeg

With this code it works in CMS8 and 9.

Can you check and confirm?

#3 Updated by Julian Mair 6 months ago

Yeah, you're right, my snippet doesn't work! :)
Initialy, this snippet was a bit larger and more complicated (the fallback part was some kind of a FLUIDTEMPLATE) so i changed it on the fly without controlling it if is actually working.

But, nevertheless, even with your corrected config it doesn't work either... i still get the error message.

Could it be that ddev (local development env) cause the problem? ATM, i have no possibility to test the project on a real server...

#4 Updated by Richard Haeser 6 months ago

I'm working on a ddev setup myself as well. The problem is that the og:image:type can not be set, before an og:image is set. If the og:image is failing, it will result in the message that it can't handle the og:image:type. Maybe you can try this in another installation?

#5 Updated by Julian Mair 6 months ago

Yep, true - I came to the same result while debugging.

I tried to make a new instance with a plain ts template with only the `og:image` tags ... but same result.

But i encountered a strange behavior while debugging:
On line `1037` in `\TYPO3\CMS\Core\TypoScript\TypoScriptService`, the function 'convertTypoScriptArrayToPlainArray' rearrange the order of the array items, which - I think - cause this mess (see screenshot).

Could this be the problem? Does this happen also in your instance, or just in mine?

#6 Updated by Julian Mair 4 months ago

After I xdebugged the hell out of this, I'm pretty sure that the ordering of the array is completely messed up (see screenshot above), after the 'convertTypoScriptArrayToPlainArray' function call...

Is this even fixable at all? Or can I go around this error by adjusting my config? Does nobody have ever had such a problem?

I don't know how to continue...

#7 Updated by Richard Haeser 3 months ago

  • Status changed from Needs Feedback to New

Also available in: Atom PDF