[TYPO3-english] TYPO3 and canonical URLs

Michael Cannon mc at acqal.com
Wed Apr 22 04:04:13 CEST 2009


I've reviewed a few other canonical URL creation schemes via  
TypoScript and an extension. However, I'm trying to ensure that news  
article and news category have a singular canonical URL each. The  
TypoScript below seems like it should be working, but alas it's not.

On the news category page, http://www.acqal.com/blog/c/business/article/busting-4-myths-about-open-source-162.html 
  , notice the lovely URL because the user got to it from an article,  
the canonical URL is http://www.acqal.com/blog/c/business/article/busting-4-myths-about-open-source-162.html 
  despite tx_ttnews[tt_news] being excluded.

Any ideas to get the correct canonical URL of http://www.acqal.com/blog/c/business.html 
  is appreciated.


The c and article in the URL are defined from realurl.php via

            , 'c' => array (
                 array(
                     'GETvar' => 'tx_ttnews[cat]'

             , 'article' => array(
                 array(
                     'GETvar' => 'tx_ttnews[tt_news]'


TypoScript setup
--
lib.meta.canonical = TEXT
lib.meta.canonical {
	typolink {
		parameter.data = TSFE:id
		addQueryString = 1
		addQueryString {
			method = GET
			exclude = id,tx_ttnews[backPid]
		}
		returnLast = url
	}

	wrap = <link rel="canonical" href="|" />
}

# keep article links out of canonical urls
[globalVar = GP:tx_ttnews|cat > 0]
	lib.meta.canonical.typolink.addQueryString.exclude =  
id,tx_ttnews[tt_news],tx_ttnews[backPid]
[global]

page.headerData.20 < lib.meta.canonical
--
Michael Cannon
CEO, Acqal Corporation -- Official TYPO3 Agency for Website Content  
Management
Taiwan +886 9 8329 0956  US +1 (404) 963-8850 x103  Fax +1 (866)  
275-7385
Read more at www.Acqal.com/blog







More information about the TYPO3-english mailing list