我想启用谷歌Sitelinks搜索框的网站。重点是它的自定义搜索页面是由散列片段实现的,因此JSON数据片段如下所示:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name" : "my site",
"alternateName" : "example.com",
"url": "http://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.example.com/Search/#!/Keyword-{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>当Google试图从这个部分"required name=search_term_string"中提取信息以显示站点链接搜索框时,会遇到一个问题:
: http://schema.org/True
valueName: missing and required我怀疑谷歌可能只是期望查询字符串中的搜索字符串,而不是哈希片段,除了重定向之外,还有什么建议呢?
发布于 2015-06-21 09:55:04
感谢@unor,我找到了解决方案,所以最后的代码如下所示:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name" : "example",
"alternateName" : "example.com",
"url": "http://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.example.com/Search/#!/Keyword-{search_term_string}/",
"query-input": {
"@type": "PropertyValueSpecification",
"valueRequired": true,
"valueMaxlength": 100,
"valueName": "search_term_string"
}
}
}
</script>
https://stackoverflow.com/questions/30815872
复制相似问题