Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

typo3 - TypoScript - Render meta tag only if not allready set

I use the following TypoScript to render the og:image meta tag

page.meta.og:image = TEXT
page.meta.og:image {
    typolink {
        parameter {
            cObject = IMG_RESOURCE
            cObject {
                file {
                    import.data = levelfield : -1 , og_image, slide
                    treatIdAsReference = 1
                    import.listNum = 0
                }
            }
        }

        returnLast = url
        forceAbsoluteUrl = 1
    }

    attribute = property
    if.isTrue.data = levelfield : -1 , og_image, slide
}

This works well and as expected.
But on some pages I set the og:image meta tag programmatically in a plugin.
That results in the problem that I have multiple og:image tags in my finished rendered page.

How can I extend the TypoScript above to only act if not already an og:image tag is set?

//edit I am on typo3 v10.4


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...