0

我习惯tt_news在网站上发布新闻。我有 3 个使用相同新闻内容的域,我想为新闻生成一个规范标签,它只指向一个(主)域。我有以下 TypoScript,但它会生成具有三个不同 url 的规范标签。

[globalVar = GP:tx_ttnews|tt_news > 0]
page.headerData.1422 = TEXT
page.headerData.1422 {
    typolink.parameter.data = TSFE:id
    typolink.forceAbsoluteUrl = 1
    typolink.returnLast = url
    typolink.additionalParams.cObject = COA
    typolink.additionalParams.cObject {
        10 = TEXT
        10.dataWrap = &tx_ttnews[tt_news]={GP:tx_ttnews|tt_news}
        10.if.isTrue.data = GP:tx_ttnews|tt_news
        20 = TEXT
        20.dataWrap = &tx_ttnews[cat]={GP:tx_ttnews|cat}
        20.if.isTrue.data = GP:tx_ttnews|cat
    }
    wrap = <link href="|" rel="canonical">
}
[END]

有什么建议吗?

4

1 回答 1

0

我会删除“forceAbsoluteURL”并自行添加baseUrl。

[globalVar = GP:tx_ttnews|tt_news > 0]
page.headerData.1422 = TEXT
page.headerData.1422 {
    typolink.parameter.data = TSFE:id
    # typolink.forceAbsoluteUrl = 1
    typolink.returnLast = url
    typolink.additionalParams.cObject = COA
    typolink.additionalParams.cObject {
        10 = TEXT
        10.dataWrap = &tx_ttnews[tt_news]={GP:tx_ttnews|tt_news}
        10.if.isTrue.data = GP:tx_ttnews|tt_news
        20 = TEXT
        20.dataWrap = &tx_ttnews[cat]={GP:tx_ttnews|cat}
        20.if.isTrue.data = GP:tx_ttnews|cat
    }
    wrap = <link href="http://example.com/|" rel="canonical">
}
[END]
于 2013-08-26T14:16:39.137 回答