Search code examples
typo3tx-news

news :: RealURL Path for MetaTag og:url for detailpage


I want to render the meta tag og:url for a detailpage of a news item. I have the following TS:

page.headerData.2999 {
    wrap = <meta property="og:url" content="{$extglobal.domain}|" />
    10 = TEXT
    10 {
        typolink {
            parameter.data = TSFE:id
            returnLast = url
        }
    }
    20 = TEXT
    20 {
        data = GP:tx_news_pi1|news
        stdWrap.wrap = &tx_news_pi1[news]=|
        required = 1
    }
}

But the url in the og:url metag tag is rendered as:

https://example.com/news/detailpage/&tx_news_pi1[news]=1671

Any ideas how to achieve the full realUrl path for og:url?


Solution

  • Thanks, I found a solution to make my TS working:

        page.headerData.1038 >
    page.headerData.2999 = COA
    page.headerData.2999 {
        wrap = <meta property="og:url" content="{$extglobal.domain}|" />
        10 = TEXT
        10 {
            typolink {
                parameter.data = TSFE:id
                additionalParams {
                    data = GP:tx_news_pi1|news
                    rawUrlEncode = 1
                    wrap = &tx_news_pi1[news]=|
                }
                useCacheHash = 1
                returnLast = url
            }
        }
    }