Home » Web Design and Development » Search Engine Optimisation ( SEO ) » How to add search box in websites google search results using “Sitelinks Searchbox” ?

How to add search box in websites google search results using “Sitelinks Searchbox” ?

Have you ever seen, for some websites we seen a search box appearing inside google search results like as below,


Above is just an example to demo, how the search box inside google search results looks like, when you searched “pinterest” in google and you can see an another search box appearing in google search results, which allows users to type another search text, as seen where user can type “pizza” which will actually search for text “pizza” only on pinterest.com without browsing to pinterest.com website and then going to search.

Google Search can expose a search box scoped to your website when it appears as a search result. This search box is powered by Google Search. However, if you wish to power this search box with your own search engine, or if you want search results also to include an associated mobile app, you can do so using structured data embedded on your website.

To implement this feature, you will need following things,

  • Access to edit source code of your websites home page
  • Properly setup search mechanism on your website, if you don’t have setup search mechanism in your website, you can setup the same using “google custom search engine

Here, we have setup the search mechanism at out another website searching the queries as https://www.greenecosystem.in/results.html?q=Biodiversity

Copy the below code and paste it into your website home page as, Note: This code needs to be pasted only on home page and not on any other page, and in “head” html tag.

<script type="application/ld+json"&gt;
   "@context": "https://schema.org",
   "@type": "WebSite",
   "url": "https://www.your_website.com/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "https://www.your_website.com/results.html?q={search_term}",
     "query-input": "required name=search_term"

In the above link, change “your_website.com” to actual link of your website.

You can test your above structured data using https://search.google.com/structured-data/testing-tool after editing the home page and then enter the home page url to this tool and it should show “0 Errors, 0 Warnings”

More reference : https://developers.google.com/search/docs/data-types/sitelinks-searchbox

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment