Issue Bug Closed

#93383og:image only works on rootsite with typoscript & rootline-slide

Gabriel Kaufmann TYPOworx GmbH | NewMedia 01/29/21, 12:55 updated 07/21/24, 14:59

Description

My customer requires og:image working on all pages. I tried to fetch the og_image from rootpage (og_image reference).

But it doesn’t seem to work on subpages (only rootpage).

og:image {
    required = 1
    attribute = property

    cObject = FILES
    cObject {
        maxItems = 1
        # Notice:
        # og_image has been added to $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',og_image';
        references.data = fullRootLine: 0, og_image

        renderObj = COA
        renderObj {
            10 = IMG_RESOURCE
            10 {
                file {
                    import.data = file:current:uid
                    treatIdAsReference = 1

                    width = 1200
                    height = 630c
                }

                stdWrap {
                    typolink {
                        parameter.data = TSFE:lastImgResourceInfo|3
                        returnLast = url
                        forceAbsoluteUrl = 1
                    }
                }
            }
        }
    }
}

Btw. twitter:image works fine the same way – even without having to add it to addRootLineFields!

I think there might be a bug or something?! Did not figure out either in TypoScript nor PHP/Core stuff where it stucks.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 5

  1. Gabriel Kaufmann TYPOworx GmbH | NewMedia commented 01/29/21, 13:16

    Did some debugging. For some reason in MetaTagGenerator TSFE-<pSetup[‘meta.’] will not have og:image even if it is defined in typoscript like in the example above!

  2. Gabriel Kaufmann TYPOworx GmbH | NewMedia commented 01/29/21, 13:21

    Also noticed TYPO3 throws exception trying to set og:image:url using Typoscript. But this sub-property is defined in \TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagManager to be allowed!

  3. Simon Schaufelberger changed description 04/26/22, 22:20

  4. Riccardo De Contardi changed Related to #87625 07/21/24, 14:46

  5. Riccardo De Contardi commented and changed status New Closed 07/21/24, 14:59

    Sorry for this late reply. I tend to close this issue for the following reasons:

    1. $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] has been removed since version 13.2 – see https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/Typo3ConfVars/FE.html#confval-typo3-conf-vars-fe-addrootlinefields

    2. The issues about setting og:image via TypoScript should have been solved – see the related issue #87625. I have been able to set a simple working TypoScript example like the one written on #87625:

    page.meta {
    og:image.stdWrap.cObject = TEXT
    og:image.stdWrap.cObject {
        if.isFalse.field = og_image
        stdWrap.typolink {
            parameter.stdWrap.cObject = IMG_RESOURCE
            parameter.stdWrap.cObject.file = fileadmin/Images/some_image.png
            returnLast = url
            forceAbsoluteUrl = 1
        }
    }
    }

    If you think that this is the wrong decision or there is still work to be done here, please reopen this issue or open a new issue with a reference to this one. Thank you.