So if I google StackOverflow, I get the following result (with a search bar):
Is there a way to get this search box to display on my website using some HTML or Javascript code?
You can add sitelinks at the "account", "campaign", or "ad group" level. You specify the link text (what shows to people) and the URLs (the pages they click to). In some cases, Google might supplement your sitelinks with descriptions that you've provided about those pages.
In order to do so, go to Google search and type 'site:Sitename.com' and in place of 'Sitename', users have to mention the name of their website. If the content is listed, you will be able to find it after you click on search.
You need to add some Schema Code to your website's HTML like this:
<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>
After adding the above Schema Code, you will have to submit your URL to Google via this link: https://developers.google.com/structured-data/testing-tool/
N.B. You will need to change the url
and target
links to your own domain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With