我在雨果(Hugo)上有一个多语言网站,现在自动生成的站点地图是以下内容:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://domain/en/sitemap.xml</loc>
<lastmod>2022-04-20T08:34:57+02:00</lastmod>
</sitemap>
<sitemap>
<loc>https://domain/it/sitemap.xml</loc>
<lastmod>2022-04-20T08:34:57+02:00</lastmod>
</sitemap>
</sitemapindex>
问题是,英语中的所有内容(默认语言)中不包含 /en en url中的所有内容,而只是简单/产品 /博客。意大利内容中包含URL中的语言指示,例如 /it /prodotti, /it /blog。
在站点地图方面,似乎不建议在 /en /entemap中使用英语站点地图。它应该在 /domain/sitemap_en.xml中。
关于如何自定义站点地点本地化URL的任何线索?
谢谢。
I have a multilanguage website in Hugo and right now the sitemap generated automatically is the following:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://domain/en/sitemap.xml</loc>
<lastmod>2022-04-20T08:34:57+02:00</lastmod>
</sitemap>
<sitemap>
<loc>https://domain/it/sitemap.xml</loc>
<lastmod>2022-04-20T08:34:57+02:00</lastmod>
</sitemap>
</sitemapindex>
The issue is that all the content in English, which is the default language, does not contain /en in the url but simply the slug itself, such as /products /blog. The italian content contains the language indication in the url instead, such as /it/prodotti, /it/blog.
Sitemap-wise, it doesn't seem to be advisable to have the english sitemap in /en/sitemap. It should be in /domain/sitemap_en.xml instead.
Any clue on how to customise the localised url of the sitemap?
Thank you.
发布评论
评论(1)
这是SiteMapIndex的Hugo内置模板:
他们使用
.sitemapabsurl
varible,但我没有从文档中找到的文档中找到。 。但是,您可以使用.permalik
重写SiteMapIndex。Here is the hugo Built-in Template for sitemapindex:
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/sitemapindex.xml
They use
.SitemapAbsURL
variable, but I didn't find in documentation from where it came. However, you could rewrite sitemapindex for example with.Permalik