在实施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>