How to Make Sitelinks Search Box in Magento 2?
11-11-2024
Several years ago, Google introduced the Sitelinks Search Box. Sitelinks Search Box is a search box above Sitelinks, introduced and implemented by Google to help users search content on your site more directly and easily. When enabled, this search box will appear below the main search result from a certain brand. So, after searching for a brand in Google, you can directly use the search engine of the online store or website where you want to search for something. Results will be displayed on the search results page of the relevant page.
Example of sitelinks search box
Here is an example search result for “Youtube” on Google that returns a sitelinks search box for the youtube site:
With the Google Sitelinks search box, people can reach your content more quickly from search results. Searchers sometimes also use navigation queries - enter the brand name or URL of a web page to create a more detailed query on the site. For example, someone wants to search for a guilty dog video on YouTube. They type YouTube or you-tube or youtube.com into Google Search, follow the link to YouTube, and then search for a dog video.
Sitelinks search box removes the steps: Query for youtube displays a specific sitelinks search box in the sitelinks, so users can immediately search for guilty dog videos without having to click through the site.
Add a Sitelink Search box to your site
It is not difficult to make your site be eligible for a Sitelink Search box. This process includes three steps and takes care of the technical side. So you should be patient and implement the following steps:
1. Install a search engine to work on your site
Queries from Sitelinks Search Box direct users to the search results pages on your site, so you will need to have the functionality of a search engine to enable this feature. If your site does not have search engines, you can set up with Google Custom Search Engine or use any search engine you like.
2. Add schema.org markup on your homepage
Another very simple step, put the following code in the source code of the homepage, edit the “URL” and “target” fields to match your site’s information.
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://query.example.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
“Url” - this is an attribute that specifies the URL of the web page. It must match the canonical URL of your domain’s home page. PotentialAction:target: This attribute specifies a URL search type for sending queries to the site’s search engine. Query-input - the value for the query-input attribute name must match the string enclosed in curly brackets in the target property of the potentialAction.
3. Set up a preferred canonical URL for your homepage
You need to use the rel="canonical"
link factor on all variants of the homepage. This helps Google Search choose the correct URL for your markup.
When you have completed all of this and Google considers your site is eligible. Actually, Sitelinks Search Box will display on your site.
How to prevent Sitelink search box for appearing
There is a way if you do not want to display the Sitelink search box on the SERPs, you can add the following tag to the source:
<meta name="google" content="nositelinksearchbox" />
From that, the Sitelinks search box will be disabled like a part of Googlebot crawling and processing of the page.
Conclusion
Making Sitelinks Search Box is not difficult. Now it is high time to learn how to make a sitelink search box to differentiate and attract customers. Besides that, having a Sitelink Search Box can help increase the traffics to your website.