[英]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. 我想为新闻项的detailpage渲染meta标记og:url。 I have the following TS:
我有以下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: 但是og:url metag标记中的url呈现为:
https://example.com/news/detailpage/&tx_news_pi1[news]=1671 https://example.com/news/detailpage/&tx_news_pi1[news]=1671
Any ideas how to achieve the full realUrl path for og:url? 有什么想法如何实现og:url的完整realUrl路径?
You have to add the additional URL parameters to the typolink
part, either with additionalParams
( https://docs.typo3.org/typo3cms/TyposcriptReference/latest/Functions/Typolink.html#additionalparams ) or addQueryString
( https://docs.typo3.org/typo3cms/TyposcriptReference/latest/Functions/Typolink.html#addquerystring ). 你必须额外的URL参数添加到
typolink
部分,无论是与additionalParams
( https://docs.typo3.org/typo3cms/TyposcriptReference/latest/Functions/Typolink.html#additionalparams )或addQueryString
( https://开头的文档。 typo3.org/typo3cms/TyposcriptReference/latest/Functions/Typolink.html#addquerystring )。 With additionalParams
you can set your own parameters to add. 使用
additionalParams
您可以设置自己的参数来添加。 With addQueryString
you can add the parameters of the current URL to the URL. 使用
addQueryString
可以将当前URL的参数添加到URL。
However the news
extension supports Open Graph meta tags by default. 但是,
news
扩展默认情况下支持Open Graph元标记。 More on how to configure it can be found here: https://docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#opengraph 有关如何配置它的更多信息,请参见: https : //docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#opengraph
Thanks, I found a solution to make my TS working: 谢谢,我找到了使我的TS正常工作的解决方案:
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
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.