Recently Google has announced the ability to add a search box to their search results page when someone searches for your site directly.
https://developers.google.com/search/docs/data-types/sitelinks-searchbox
In this article, we'll walk you through setting this up for your site. Add the following code to the head tag of your templates for all pages. Replace the "url" parameter with the URL of your home page. For the "target" parameter, do a search on your site and take that URL and replace the search term you used to do the search with "{search_term_string}"
<script type="application/ld+json">{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.mysite.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.mysite.com/search.html?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}</script>
Comments
0 comments
Article is closed for comments.