Google 无法获取我的 sitemap.xml 文件

Google couldn't fetch my sitemap.xml file

我有一个用于我的旧 wow 公会的小型 flask 站点,但我未能成功让 google 阅读我的 sitemap.xml 文件。我能够使用 googles Search Console 成功验证我的网站,它似乎可以很好地抓取它,但是当我提交我的站点地图时,它列出的状态为 "Couldn't fetch"。当我单击它以获取更多信息时,它只显示 "Sitemap could not be read"(无帮助)

我最初使用站点地图生成器网站(忘记是哪个)来创建文件,然后将其添加到我的路由文件中,如下所示:

@main.route('/sitemap.xml')

def static_from_root():

    return send_from_directory(app.static_folder, request.path[1:])

如果我导航到 www.mysite.us/sitemap.xml,它将显示预期的结果,但 google 无法获取它。

然后我改变了一些东西,开始使用 flask-sitemap 来生成它,如下所示:

@ext.register_generator

def index():

    yield 'main.index', {}

当我直接导航到文件时,这也能正常工作,但 google 又不喜欢这样。

我很茫然。似乎没有任何方法可以从 google 获得帮助,到目前为止我的网络搜索没有找到任何有用的东西。

供参考,这是当前站点地图 link:www.renewedhope.us/sitemap.xml

我终于明白了。这似乎违背了 google 的建议,但我将站点地图提交为 http://renewedhope.us/sitemap.xml 并且最终奏效了。

来自他们的文档:

Use consistent, fully-qualified URLs. Google will crawl your URLs exactly as listed. For instance, if your site is at https://www.example.com/, don't specify a URL as https://example.com/ (missing www) or ./mypage.html (a relative URL).

我认为这仅适用于站点地图文档本身。

将站点地图提交到 google 时,我试过...

http://www.renewedhope.us/sitemap.xml  
https://www.renewedhope.us/sitemap.xml   
https://renewedhope.us/sitemap.xml   

他们能够从中获取站点地图的唯一格式是:

http://renewedhope.us/sitemap.xml

希望这些信息可以帮助面临同样问题的其他人:)

将此标签放入您的 robots.txt 文件 Sitemap: domainname.com/sitemap.xml。希望这会有所帮助。