在向站点添加多语言支持后,我遵循了Google 对其 XML 站点地图的建议,将 hreflang 链接合并到备用语言版本。
但是,在这样做之后,我发现各种在线验证器(例如这个)正在返回这些验证错误:
元素'{ http://www.w3.org/1999/xhtml }link':没有匹配的全局元素声明可用,但严格通配符要求
我的站点地图的净化摘录如下。我保留了实际的格式(由于框架如何呈现它而没有整齐地缩进)以防万一:
<?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"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
http://www.w3.org/1999/xhtml
http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"><url>
<loc>http://dev.domain.com/template/en-GB/</loc>
<lastmod>2017-02-17</lastmod>
<xhtml:link rel="alternate" hreflang="en-GB" href="http://dev.domain.com/template/en-gb/" /><xhtml:link rel="alternate" hreflang="de" href="http://dev.domain.com/template/de-de/" /><xhtml:link rel="alternate" hreflang="en-PH" href="http://dev.domain.com/template/en-gb/" /><xhtml:link rel="alternate" hreflang="cs-CZ" href="http://dev.domain.com/cz/cs-cz/about-domain/thing" /><xhtml:link rel="alternate" hreflang="af-ZA" href="http://dev.domain.com/cz/cs-cz/about-domain/thing" /><xhtml:link rel="alternate" hreflang="ar-QA" href="http://dev.domain.com/cz/cs-cz/about-domain/thing" /><xhtml:link rel="alternate" hreflang="de-DE" href="http://dev.domain.com/de/de-de/applications" /><xhtml:link rel="alternate" hreflang="x-default" href="http://dev.domain.com/template/en-gb/" />
</url><url>
<loc>http://dev.domain.com/template/en-gb/about-domain-en</loc>
<lastmod>2017-02-28</lastmod>
<xhtml:link rel="alternate" hreflang="en" href="http://dev.domain.com/template/en-gb/about-domain-en" /><xhtml:link rel="alternate" hreflang="de-DE" href="http://dev.domain.com/template/de-de/uber-domain" /><xhtml:link rel="alternate" hreflang="en-PH" href="http://dev.domain.com/template/en-gb/about-domain-en" />
</url><url>
<loc>http://dev.domain.com/template/en-gb/about-domain/thing-en</loc>
<lastmod>2016-10-20</lastmod>
<xhtml:link rel="alternate" hreflang="en-GB" href="http://dev.domain.com/template/en-gb/about-domain/thing-en" /><xhtml:link rel="alternate" hreflang="de-DE" href="http://dev.domain.com/template/de-de/uber-domain/thing" /><xhtml:link rel="alternate" hreflang="en-PH" href="http://dev.domain.com/template/en-gb/about-domain/thing-en" />
</url></urlset>
我看不出 XML 有任何问题,它看起来完全遵循 Google 的建议。我是否可以安全地将其部署到生产环境中,还是在我弄清楚问题出在哪里之前,谷歌会受到惩罚吗?