This extra search box removes an extra query for the user to click throgh the site to make the search, instead the user can search within the site search box displayed in the sitelinks section.
Set Up Procedure:
<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebSite", "url": "https://www.example-petstore.com/", "potentialAction": { "@type": "SearchAction", "target": "https://host.example-petstore.com/search?q={search_term}", "query-input": "required name=search_term" } } </script>
Queries from the sitelinks search box direct the user to the search results page on your site, so you'll need to have a functioning search engine in order to enable this feature.
No search engine for your site? You can set one up with Google Custom Search Engine.
target
property of SearchAction
. The URL pattern must point to the same domain that hosts the content being searched. It must also include a variable name in braces that is a placeholder for the user's search query. In addition, you'll want to make sure that the URL pattern with the placeholder replaced by an actual query yields a valid search results page on your site. The example below shows the markup in JSON-LD: