--- STEP 1 --- This is the search box form. Copy this code in all your html/php pages. People will search here the information. ( You can see the code below here as well: https://pastebin.com/1X6xwbBK )
<form action="https://neculaifantanaru.com/search.html" method="get" id="site-search"> <fieldset> <!-- <label for="search">Search in website</label> --> <input type="text" name="q" id="q" value="" /> <button type="submit" class="btn btn-inverse">search</button> </fieldset> </form>
--- STEP 2 --- Create a new html page named search.html. And add this code in the <head> section, more likely before </head>:
<script> (function() { var cx = 'YOUR-NUMBER-CODE'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script>
YOUR-NUMBER-CODE you can get it by clicking this link https://cse.google.com/cse/all (Here you must add your new search engine. Choose OFF on the option "Search the entire web" in order to find results only on your website, not the entire web.)
Then add this code in the <body> section, on the same page search.html
<div class="main-content"> <h1>Search the site</h1> <gcse:searchbox-only></gcse:searchbox-only> <gcse:searchresults-only></gcse:searchresults-only> </div>
That's all folks.
If you like my code, then make me a favor: translate your website into Romanian, "ro".
Also, see this VERSION 2 or VERSION 3 or VERSION 4 or VERSION 5 or VERSION 6 or VERSION 7