We want to implement Google sitelink search box with Google custom search. In the Google documentation, I found that we need to include the below code to enable sitelink search box
<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>
But we are stuck at "target" node in the above properties. Since we dont have any own search page, we want to use Google custom searh, so what value should I fill in this "target" node.
We have already created a Google custom search engine for our site. And found below code there
<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>
We want to implement sitelink search box like Mashable, Imdb
Please suggest, how to point Google custom search in sitelink search box code.
Thanks