I try to create a sitemap for a typo3 installation with multible languages. I tried like 10 extensions and noone of them seems to fit. Some of them create the sitemap just for the default language. Some of them create links for all languages, but they also create links to pages that are not translated at all.
Idealy I would like to output a sitemap like this: https://support.google.com/webmasters/answer/2620865?hl=en
And only add links to other languages if that page exists in that language. Also we do not use the default language at all. So I just want the localized links in it.
I also tried to create something with fluid and then output it as XML, without good success.
Any idea how to archive that?
Edit (this edit belongs to the answer of Jozef Spisiak and his changes to seo_basics)
The changed seo_basics from Jozef Spisiak output following code:
Config:
tx_seo_xmlsitemaps.10.sysLanguageHrefLangMappings {
# sys_language_uid = hreflang
1 = de-ch
4 = de-at
12 = de
}
Output:
<url>
<loc>http://domain.com/</loc>
<lastmod>2016-10-13T17:53:56+02:00</lastmod>
</url>
<url>
<loc>http://domain.com/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/ch/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/at/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/de/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
We are using seo_basics and created this feature together with typoscript configuration on which languages to show in sitemap. You can check the code here: https://github.com/pixelant/t3ext-seo_basics/
For configuration, check commented out section of typoscript setup. We also created pull request, but it is still waiting for feedback: https://github.com/b13/t3ext-seo_basics/pull/30