eljoest dev

We've been using typo3 6.2 with tt_news and dd_googlesitemap for quite some time now. The default language version works as expected but the URLs and sitemaps for translated tt_news items sometimes get a -1 added at the end.

Additionally the sitemap generated by dd_googlesitemap for translated tt_news items links to documents that don't quite work. Usually that means the article image is missing as is the document title in some parts of the page (e.g. breadcrumb navigation).

After some digging in the RealURL caches I noticed that dd_googlesitemap and tt_news generate different URLs for translated items. For L=0 both link to ?id=27&tx_ttnews[tt_news]=101 but for L=1:

  • tt_news uses ?id=27&tx_ttnews[tt_news]=101&cHash=b7...
  • dd_googlesitemap uses ?id=27&tx_ttnews[tt_news]=104&cHash=41...

Some more research into the database reveals, that the tt_news entry with uid 104 is the translated child of the document with uid 101:

uid    l18n_parent   sys_language_uid   title     
101    0             0                  native title
104    101           1                  translated title

It seems someone else has had a possibly related problem as well. Turns out that (at least for our setup) the following change to Classes/Generator/TtNewsSitemapGenerator.php completely solved the problem:

         }
         if ($link == '') {
             $conf = array(
-                'additionalParams' => '&tx_ttnews[tt_news]=' . $newsRow['uid'],
+                'additionalParams' => '&tx_ttnews[tt_news]=' . ($newsRow['l18n_parent']?$newsRow['l18n_parent']:$newsRow['uid']),
                 'forceAbsoluteUrl' => 1,
                 'parameter' => $forceSinglePid ?: $this->singlePid,
                 'returnLast' => 'url',

I contacted the author of both RealURL and dd_googlesitemap but he's rather busy and doesn't want to include the change. So here it is for those who have the same problem and wish to give it a try.