我们希望通过Google自定义搜索实施Google附加链接搜索框。在谷歌documentation,我发现我们需要包括下面的代码,使站点链接搜索框Google自定义搜索的Google附加链接搜索框
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example-petstore.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://query.example-petstore.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
但我们在上面的性质“目标”节点卡住。由于我们没有自己的搜索页面,因此我们希望使用Google自定义搜索,因此我应该填写这个“目标”节点的值。
我们已经为我们的网站创建了Google自定义搜索引擎。发现下面的代码有
<script>
(function() {
var cx = 'CX_ID';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
请建议,如何指向站点链接搜索框代码谷歌定制搜索。
感谢
也许[this](http://moz.com/blog/sitelinks-search-box)会帮助你。 – Shishdem 2015-03-02 11:43:06
感谢@Shishdem的回复。但是这个链接也指向相同的Google [文档](https://developers.google.com/structured-data/slsb-overview):( – pankaj 2015-03-02 12:35:47
任何其他建议?? – pankaj 2015-03-03 10:08:48