tt_news的规范标记应该从几个域指向一个域

时间:2013-08-26 12:26:42

标签: typo3 typoscript canonical-link tt-news

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

[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]

任何sugestions?

1 个答案:

答案 0 :(得分: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]