gpt4 book ai didi

reactjs - 按语言的动态站点地图

转载 作者:行者123 更新时间:2023-12-04 16:33:33 25 4
gpt4 key购买 nike

我有几个静态站点地图(一种语言的站点地图,即 sitemap_en.xml、sitemap_de.xml),我想要一个最终的静态 sitemap.xml( http://example.com/sitemap.xml ),它根据语言(http://example.de/sitemap.xml)针对好的站点地图> sitemap_de.xml)
我想知道如何在 react 应用程序中以我可以做的 ssr 方式做到这一点

app.get('/sitemap.xml', function(req, res) {
res.sendFile('good_path_to_correct_sitemap.xml');
});
也许有更好的解决方案来处理多域多语言网站中的多个静态站点地图

最佳答案

您需要将所有站点地图集中到一个站点地图中 index ,引用:

If you have many sitemaps, you can use a sitemaps index file as a wayto submit them at once. The XML format of a sitemap index file is verysimilar to the XML format of a sitemap file.


但就您而言,由于每种语言都在不同的域中提供服务,您可以执行 cross submit ,引用:

By default, this will result in a "cross submission" error since youare trying to submit URLs for www.host1.com through a Sitemap that ishosted on www.sitemaphost.com (and same for the other two hosts). Oneway to avoid the error is to prove that you own (i.e. have theauthority to modify files) www.host1.com. You can do this by modifyingthe robots.txt file on www.host1.com to point to the Sitemap onwww.sitemaphost.com.

关于reactjs - 按语言的动态站点地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64459514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com