Google 附加链接搜索框 - 指定输入值时出错

Google Sitelinks Searchbox - error when input value specified

我正在实施 Google's Sitelinks searchbox on my website, and using their Structured Data Testing tool 来验证。

我收到以下错误,经过一些消除,这是因为我使用了默认输入值 value="Search the site",如果我删除此 property/value 或将其设置为 null value="", 页面验证正常!

由于我的搜索框没有默认值,所以有解决办法吗?

Google 的 SDTT 似乎对 value 中每个 space 分隔的字符串给出错误,从第二个开始。所以 value="a" 没有错误,value="a b" 有一个错误,value="a b c" 有两个错误等等

但是您的问题可以在 HTML 级别得到解决:

因为搜索"Search the site"似乎没有意义,所以不应该使用value attribute。它应该只用于默认值。

改用placeholder attribute

The placeholder attribute represents a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.

因此您的 input 元素可以是:

<input type="text" name="q" placeholder="Search the site" id="keyword" title="Enter search keywords" itemprop="query-input" required />