Google Site Search Link Box

Google implemented a new feature which allows the internal search engine of a website to be displayed directly on the search result page when the user searches for the name of the website .

Site Search link

With the appropriate markup, performing a search in this box redirects directly to the search result page on your website.

In order to drive traffic to the website, we need to implement the schema.org markup on the homepage (no need to add it on the other pages) like so:

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://www.yourdomain.com/",
   "potentialAction": {
  "@type": "SearchAction",
  "target": "https://query.yourdomain.com/search?q={search_term_string}",
  "query-input": "required name=search_term_string"
   }
}
</script>
  • url — This property specifies the URL of your website. It must match the canonical URL of your domain’s homepage.
  • potentialAction:target — This property specifies a search URL pattern for sending queries to your site’s search engine. Key points about the URL pattern:
    • It must include a string enclosed in curly braces that is a placeholder for the user’s search query (e.g., {search_term_string} ). The string inside the curly braces must also appear in the name attribute of the query-input property.
    • It must point to the same domain on which the markup is found.
    • An actual query string instead of the placeholder string must produce a valid search results page on your site.
  • query-input — the value for the name attribute of query-input must match the string enclosed inside curly braces in the target property of potentialAction.

Source : https://developers.google.com/webmasters/richsnippets/sitelinkssearch