Canonical tag for tt_news should pointing from couple domain to only one

1k views Asked by At

I'm usign tt_news for publishing news on sites. I have 3 domains which are using the same news content, and I would like to generate a canonical tags for news which will point to only one (main) domain. I have the following TypoScript, but it generates canonical tags with three different urls.

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

Any sugestions?

1

There are 1 answers

0
maholtz On BEST ANSWER

i would just remove "forceAbsoluteURL" and add the baseUrl in your wrap on your own.

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