【发布时间】:2018-12-23 23:22:24
【问题描述】:
在一个网站上,我们使用 HTML 头部 base 标记。原因是通过相对 URL 链接到静态资源很方便,而且很难更改。内容 URL 始终是完全限定的。所以head 部分看起来像:
<head>
<base href="http://example.com/static/" />
</head>
现在,我们使用 RDFa 来指定页面上的结构化数据。要填充即schema:Product 页面,请说http://example.com/product1。现在,问题来自base标签:在没有任何其他修复的情况下,RDFa解析器认为整个RDFa数据大约是http://example.com/static,而不是http://example.com/product1。
我们尝试在<html> 或<body> 上添加属性about="http://example.com/product1",结果喜忧参半。
这间歇性地适用于 Google 的结构化数据测试工具。从某种意义上说,大约 2 个月前它在添加到 <body> 时似乎可以正常工作,现在在添加到 <head> 时似乎可以正常工作。
但是,在“结构化数据”下的 Search Console 中,这种情况甚至不会间歇性地起作用。它曾经在大约 8 个月前与 <html about="..."> 一起工作,但现在这两种方式都行不通。我的意思是页面被编入索引,而不是结构化数据。
那么,是否有一种标准的、经过验证的方法可以让 Google(以及任何通用元解析器)正确地了解具有与其实际 URL 不同的通用 <base href="" /> 标记的网页的 URL?
示例 1
假设以下内容由 HTTP GET http://bar.com/product1 渲染
<html prefix="schema: http://schema.org/">
<head>
<base href="http://foo.com/" />
</head>
<body about="http://bar.com/product1" typeof="schema:Product">
<span property="schema:name">Bar product</span>
</body>
</html>
以上:
- 约 8 个月前基于 Google Search Console/结构化数据和 Google 结构化数据测试工具约 2 个月前与 Google 合作
- 自 8m 前以来未使用基于 Google Search Console/结构化数据的 Google(未报告错误,但未将新内容提取到结构化数据报告中),未使用测试工具 ATM 进行解析
示例 2
<html prefix="schema: http://schema.org/" about="http://bar.com/product1" typeof="schema:Product">
<head>
<base href="http://foo.com/" />
</head>
<body>
<span property="schema:name">Bar product</span>
</body>
</html>
- ~2 个月前未使用 Google 结构化数据测试工具进行解析
- 正在使用 Google 结构化数据测试工具 ATM 进行解析
- 未与基于 Google Search Console/结构化数据 ATM 的 Google 合作(未报告错误,但未将新内容提取到结构化数据报告中)
【问题讨论】:
标签: html url google-search google-rich-snippets rdfa