Google のカスタム検索で Google のサイトリンク検索ボックスを使用する方法について、私は完全に困惑しています。
2つを接続し始める方法を知っている人はいますか?
サイト リンク検索ボックスの場合、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 のカスタム検索コードを取得します。
<script>
(function() {
var cx = '006674923042857018221:WMX2084923030';
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>
いったいどうやって2つを接続するのですか?正しい方向に向けていただければ幸いです。