我尝试使用多种语言为typo3 安装创建站点地图。我尝试了 10 个扩展,但似乎没有一个适合。他们中的一些人仅为默认语言创建站点地图。其中一些为所有语言创建链接,但它们也创建指向根本未翻译的页面的链接。
理想情况下,我想输出这样的站点地图:https: //support.google.com/webmasters/answer/2620865?hl= en
如果该页面以该语言存在,则仅添加指向其他语言的链接。此外,我们根本不使用默认语言。所以我只想要其中的本地化链接。
我还尝试用流体创建一些东西,然后将其输出为 XML,但没有成功。
知道如何存档吗?
编辑(此编辑属于 Jozef Spisiak 的答案及其对 seo_basics 的更改)
来自 Jozef Spisiak 的更改后的 seo_basics 输出以下代码:
配置:
tx_seo_xmlsitemaps.10.sysLanguageHrefLangMappings {
# sys_language_uid = hreflang
1 = de-ch
4 = de-at
12 = de
}
输出:
<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>