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">
{
   "@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"
   }
}
</script>

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

Related :   Electron - Framework to Develop Cross-Platform Desktop Apps

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

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question