带hreflang标记的sitemap.xml-命名空间不正确
这是my sitemap.xml的格式带hreflang标记的sitemap.xml-命名空间不正确,xml,sitemap,hreflang,Xml,Sitemap,Hreflang,这是my sitemap.xml的格式 <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:sc
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="https://www.w3.org/1999/xhtml"
xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9
https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://example.com</loc>
<xhtml:link
rel="alternate"
hreflang="en-us"
href="https://example.com" />
<xhtml:link
rel="alternate"
hreflang="en-gb"
href="https://example.com/uk/" />
<xhtml:link
rel="alternate"
hreflang="x-default"
href="https://example.com" />
</url>
</urlset>
但是,搜索控制台一直给我一个错误,它在第10行有一个不正确的名称空间
我还尝试了这里提供的解决方案:
但我在这方面也犯了同样的错误。我做错了什么?事实证明,谷歌不喜欢xmlns:xhtml=https://www.w3.org/1999/xhtml 是HTTPS 将其转换为非HTTPs似乎已经解决了这个问题,即
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9
https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
它确实在浏览器视图中消除了默认的XML样式,但站点地图会进行验证。我想如果需要的话,可以使用XSL定制样式