提及"要求"来自Sitelinks Searchbox标记的属性

时间:2017-01-18 15:34:55

标签: schema.org json-ld google-rich-snippets search-form

在实施Google的Searchlinks Searchbox功能时,相应的表单标记是否包含required属性是否重要?或者,在将query-input值指定为required name=q的同时排除该元素是否安全。

我的JSON-LD和相应的标记如下:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "http://www.examplesite.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "http://www.examplesite.com/search/?q={q}",
    "query-input": "required name=q"
  }
}
</script>

<span class="search-display">
  <form role="search" method="get" class="search-form" action="/search/">
    <label for="s">Search</label>
    <input class="search-input" type="search" name="q" id="s" placeholder="Search..." autocomplete="off" />
    <div class="form-button-wrapper">
      <svg class="search-icon"><use xlink:href="#magnifying-glass" /></svg>
      <button type="submit">Search</button>
    </div>
  </form>
</span>

0 个答案:

没有答案