Typoscript: Override data with typolink

677 Views Asked by At

I'm trying to set the canonical url of page. If the individual field (tx_metaseo_canonicalurl) is not set then the url page should be determined by a typolink.

I tried this but it's not working:

30 = TEXT
30 {
    data = FIELD:tx_metaseo_canonicalurl
    override.typolink = {
    parameter.data = TSFE:id
    returnLast = url
    forceAbsoluteUrl = 1
    addQueryString = 1
    addQueryString.method = GET
    addQueryString.exclude = cHash,backPid
}
override.if.isFalse.field = tx_metaseo_canonicalurl
wrap = <link rel="canonical" href="|" />
required = 1

}

1

There are 1 best solutions below

0
Georg Ringer On

The last 3 lines should be inside the 30 cObj