XSD 用于带有 HREFLANG 的站点地图 [英] XSD For Sitemap with HREFLANG

查看:17
本文介绍了XSD 用于带有 HREFLANG 的站点地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在推出一个支持 20 种语言和大量区域内容(即针对特定国家或一组国家的内容)的主要网站.因此,我们有一个教科书用例在我们的站点地图中使用 xhtml:link 和 rel='hreflang'.我们通常更喜欢从 XSD 生成类,以便我们可以以编程方式生成保证兼容的 XML.我希望找到一个更新的 XSD,其中包含 xhtml:link 在定义中.但是,我不断被指向基本站点地图 xsd:http://www.sitemaps.org/schemas/sitemap/sitemap.xsd ,不支持 xhtml:link(在 xhtml-link-1.xsd 中定义).

We are launching a major website with support for 20 languages and tons of regional content (i.e. content that is targeted to a specific country or set of countries). As such, we have a textbook use case for using xhtml:link with rel='hreflang' in our sitemap. We generally prefer to generate classes from an XSD so that we can programmatically generate the XML that is guaranteed compliant. I was hoping to find an updated XSD that includes xhtml:link in the definitions. However, I keep getting pointed back to the base sitemap xsd: http://www.sitemaps.org/schemas/sitemap/sitemap.xsd , which has no support for xhtml:link (defined in xhtml-link-1.xsd).

看起来 Google 只支持 xhtml:link 元素及其支持的属性,但在我尝试手动修改基本的 sitemap.xsd 以包含它之前,我想看看是否有人花时间发布 XSD已经有 http://www.sitemaps.org/schemas/sitemap/0.9http://www.w3.org/1999/xhtml 包括?如果是这样,你能指出我正确的方向吗?或者,如果我出于某种原因在这里走错了路,我也很感激被引导到正确的方向.提前感谢您的帮助!

It looks like Google just supports an xhtml:link element with it's supported attributes, but before I try to modify the basic sitemap.xsd by hand to include this, I wanted to see if anyone has taken the time to publish an XSD that already has http://www.sitemaps.org/schemas/sitemap/0.9 and http://www.w3.org/1999/xhtml included? If so, could you point me in the right direction? Or if I'm headed down the wrong path here for some reason I also appreciate being steered in the right direction. Thanks in advance for the help!

推荐答案

来自 google 的带有 hreflang 的站点地图指南是错误的.由于命名空间中不存在 xhtml:link,因此站点地图无法验证.

Sitemap guides with hreflang from google are wrong. The sitemap doesn't validate as the xhtml:link does not exist in namespace.

将命名空间更改为以下名称,它将验证.

Change namespace to the one below and it will validate.

xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html"

这篇关于XSD 用于带有 HREFLANG 的站点地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆