use*_*309 7 seo schema.org google-rich-snippets
我从Google RichSnippets 测试工具收到此错误:
错误:页面包含属性“查询输入”,该属性不属于架构的一部分。
但我哪里做错了呢?
HTML:
<div id="dkAjaxSearch">
<input id="ajaxSearch" type="text" value="" name="search_term" itemprop="query-input">
Press Enter to search
</div>
Run Code Online (Sandbox Code Playgroud)
JSON-LD:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://domain.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://domain.com/search/{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
文档:搜索结果中改进的搜索框
It\xe2\x80\x99s 在有关操作的文档中进行了解释中进行了解释:
\n\n\n\n\n为了制定完整的请求,通常需要用户或客户提供额外的信息。为了促进这一过程,我们需要能够在潜在的行动中描述如何构建这些输入。由于我们需要这种功能来填充 Action 的任何属性,因此我们引入了使用连字符(“-”)分隔符的属性注释的概念。例如,通过在潜在操作上指定“位置输入”属性,我们表明“位置”是完成该操作的受支持输入。
\n
但由于该属性不存在(即 it\xe2\x80\x99s 未在属性表中定义)SearchAction),验证器将其报告为错误。
这个问题已经在 Schema.org\xe2\x80\x99s GitHub 上进行了讨论: SearchAction 示例使用未定义的“query-input”属性
\n\n所以你没有做错什么。除非 Schema.org 决定应该以不同的方式处理操作,否则验证器可能应该更新并-input允许-output后缀。