Error: Page contains property “query-input” which is not part of the schema

跟風遠走 提交于 2019-12-12 10:07:57

问题


I get this error from the Google RichSnippets testing tool:

Error: Page contains property "query-input" which is not part of the schema.

But where did I make a mistake?

HTML:

<div id="dkAjaxSearch">
<input id="ajaxSearch" type="text" value="" name="search_term" itemprop="query-input">
Press Enter to search
</div>

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>

Documentation: An improved search box within the search results


回答1:


It’s explained in the documentation about Actions:

Additional information is often required from a user or client in order to formulate a complete request. To facilitate this process we need the ability to describe within a potential action how to construct these inputs. Since we need this capability for filling in any property of an Action, we introduce a notion of property annotations using a hypen ("-") delimiter. For example, by specifying a "location-input" property on a potential action we are indicating that "location" is a supported input for completing the action.

But as this property does not exist (i.e., it’s not defined in the property table on SearchAction), validators report it as an error.

This issue already gets discussed on Schema.org’s GitHub: SearchAction example uses "query-input" property that is not defined

So you did not do something wrong. Unless Schema.org decides that Actions should be handled in a different way, validators should probably update and allow -input and -output suffixes.




回答2:


The problem is that the query-input value (in your case search_term_string) must match the input field name.

in your case:

<input id="ajaxSearch" type="text" value="" name="search_term" itemprop="query-input">

must be:

<input id="ajaxSearch" type="text" value="" name="search_term_string" itemprop="query-input">


来源:https://stackoverflow.com/questions/27140153/error-page-contains-property-query-input-which-is-not-part-of-the-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!