无法为 Google 创建有效的 sitemap.xml 文件

问题描述

我正在使用 Hugo 生成我的网站,并通过将其放入手动添加一个 sitemap.xml 文件 布局/站点地图.xml。

无论我尝试使用什么 sitemap.xml 文件,当我将浏览器指向站点地图 URL https://www.examplesite.ca/sitemap.xml 时,都会收到此消息。页面为空。

enter image description here

sitemap.xml 生成自:https://www.xml-sitemaps.com/

<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->


<url>
  <loc>https://www.examplesite.ca/</loc>
  <lastmod>2021-03-25T13:24:33+00:00</lastmod>
</url>


</urlset>

解决方法

您的第一个链接存在访问问题,请确保文件 sitemap.xml 可公开访问,否则将无法呈现。 Xml 代码看起来很完美,所以很可能只是访问的问题。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...