Django 站点地图效率
我在此页面上看到,可以降低站点地图的限制,以便以不同的方式分页: 在 django 中缓存站点地图
但是当我尝试生成站点地图时,它会挂起又挂起,而且永远不会出现了。
最终,如果我等待足够长的时间,我会在 Firefox 中收到此错误: XML 解析错误:未找到元素 位置:http://sitename.com/sitemap.xml 第 1 行,第 1 列:
我的网站目前有大约 70K 页面,因此我在 urls.py 中使用索引生成器。由于某种原因,虽然它不起作用。我猜这是因为我的服务器缺乏生成包含 70K 链接的站点地图的能力,但我一点也不确定。
有人有任何见解吗?
I saw on this page that it's possible to lower the limit on your sitemap so that it is paginated differently:
Caching sitemaps in django
But when I try to generate my sitemap, it hangs and hangs, and never comes up.
Eventually, if I wait long enough, I get this error in Firefox:
XML Parsing Error: no element found
Location: http://sitename.com/sitemap.xml
Line Number 1, Column 1:
My site has about 70K pages at present, so I'm using the index generator in urls.py. For some reason though it's not working. I'm guessing it is because my server lacks the power to generate sitemaps containing 70K links, but I'm not at all sure.
Does anybody have any insight?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以做的一件事是将巨大的站点地图拆分为多个文件。
也许每个文件都会包含站点的不同内容区域,并且您可以使用缓存,因为可能并非所有部分都以相同的频率更新?
http://docs.djangoproject.com /en/dev/ref/contrib/sitemaps/#creating-a-sitemap-index
One thing you could do it to split your huge sitemap into several files.
Probably each file will contain a different content area of your site and you can use caching as probably not all sections update in the same frequency?
http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/#creating-a-sitemap-index
我终于明白了这一点。事实证明我的 urls.py 配置错误。啊。
I finally figured this out. Turns out I had a misconfiguration in my urls.py. Ugh.
大站点地图?尝试 django-fastsitemaps
Big sitemaps? Try django-fastsitemaps