Have you seen those sites that have a Search bar field that is displayed right within the Google Search Results. This is called Sitelink Searchbox from Google.
Now with a simple copy/paste, you can encourage Google to add one for your website as well. This is all thanks to EvolutionX and its powerful search.
🔥 Awesome!!
Copy & Paste into your Theme Footer block
<script>
if ( window.location.pathname == '/' ){
// Index (home) page
var searchJSLD = document.createElement('script');
searchJSLD.type = 'application/ld+json';
searchJSLD.text = JSON.stringify({
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://" + window.location.hostname,
"potentialAction": {
"@type": "SearchAction",
"target": "https://" + window.location.hostname + "/search?query={search_term_string}" ,
"query-input": "required name=search_term_string" }
});
document.querySelector('body').appendChild(searchJSLD);
} else {
// Other page, do nothing
}
</script>
🔥 Pretty Awesome Right! 🔥
___________________
Test it
You can test it's working https://search.google.com/structured-data/testing-tool#
Enter in your homepage URL (This code only exists on your homepage)
Your results should look like the below
Learn more about SiteLink Search from Google