Google Site Search
Support for website and web template site search
Support for templates that include a "search_results.html". If your template includes a "search.js" or search box, see the
help.html included with your template download for the correct setup info and support links.
See Instead…
Outdated: Only for pre-2012 templates that include a "search_results.html".
If you have a "search.js" but your template does not include a "search_results.html" see your template "help.html" or check
site search options.
Search .js file locations:
The template search .js files you will be editing may be located either in your main template folder with your HTML pages or in your template "extras" folder.
Option #1: Simple Google setup:
For the easiest search setup to search your site, delete or rename the "search.js". Rename the "OPTIONAL-search-SIMPLE.js" to "search.js". Edit the "var searchdomain" in the now renamed "search.js" with your website domain name. Test the form on one of your template pages. Google should now search "your site only" from your template search box.
Note: If you are using foreign language characters during your site searches and are having any problems, try editing the "UTF-8" in 2 places to "ISO-8859-1" in the "search.js".
Option #2: Integrated Google search (Custom Search Engine):
This is the default option setup in the template in your download. This can be involved to setup but will use your template logo header and footer in the search results.
- Create a Google account if you do not have one.
- Create a search engine (login to your account.)
- Follow the directions at Google to "Create a Custom Search Engine" and click "Next".
- Enter your search engine name and "sites to search", agree to the terms and click next.
- Choose your style and click next.
- You will now be on the "3. Get the Code" screen. Select the text link "Look and feel page" above or below the code box.
- Select to highlight the "Two page", choose "Save & get code".
- In the "Specify the url in your site where you want the search results to appear:" enter your full URL: "http://your-web-domain.com/search_results.html".
- Copy and paste the code from the two boxes, "Search box code" and "Search results code", and create and paste it into a blank text document on your computer. This text file is to be used for setting up your site search. Save this text file.
- From your saved text file, copy all the code generated in the "Search Result" code box. Open the template "search_results.html" in a plain text editor. Find the "search results" code in the page and paste your results code over this code. Be sure to upload this HTML page when you upload your website.
- You will now edit the template "search.js" in 2 or 3 places; with your domain name, a new "id", and your Google "CustomSearchControl" or "cx" number from the "Search box code" that you just created in your Google account.
Replace the "your-web-domain.com" in the variable "var yourdomain" with your domain information:
var yourdomain = your-web-domain.com
Optionally replace the "id" code (not required):
id="searchbox_003488088439636726711:dzunaemraqw"
...with this code:
id="cse-search-box"
(The above edit may not be required in 2011 and later template models)
Replace the existing name="cx" value...
name="cx" value="003488088439636726711:dzunaemraqw"
Replace the above "cx" value with the new code you have generated at Google known as the "CustomSearchControl" number. This is a sample of the code you will copy into the "search.js":
var customSearchControl = new google.search.CustomSearchControl('003488088439636726711:uey5kgzpqs4');

Notes: If custom "Look and Feel", or other options, are not selected during initial search setup, it can be selected and added later. Login to your Google account and select "My Saved Searches". Select the "control panel" for the applicable search, then select "Look and Feel" from the left-hand menu links. Follow steps as outlined above.
Trouble-shooting: Integrated Google setup:
If you have done the steps above and the integrated Google search is not working, try the following:
- Make a copy of any HTML template page. The "missing.html" or "thanks.htm" is a good page to copy for this. Name it "search.htm".
- Add your generated search code to this page exactly as Google instructs. Do not add this to the "search.js" file, paste the code right into the HTML page.
- Create a results page exactly as Google indicates with a copy of a template page. Use the name for this page that Google suggests. Add your results code from your Google account to this page.
- Open the "search.htm" and test to see if your test search works.
- IF THE TEST SEARCH WORKS:
-
- Save the 2 pages you created.
- Compare the code in the "search.js" to the code in the "search.htm" you created.
- Compare the results code in the test "search.htm" and the template "search_results.html" pages.
- If you can not find the problem you can contact Allwebco support and we will look at all your files. We will need your working test pages uploaded to your hosting area to check them.
- IF THE TEST SEARCH DOES NOT WORK:
-
- Check and see if your site is listed at Google.
- Check and see if all your pages are listed in Google. You can check this under the advanced search at Google and "Search within a site or domain" option.
- If your site is not listed with Google you may need to wait a few days for it to be listed and for the search to work.
- Try searching for text that is included on your homepage.
- Make sure you have used all new generated code from your Google account.
- Check with Google site search support to see if you can locate the problem.
Option #3: Burgdorf's WebSearch:
An "OPTIONAL-Burgdorf-search.js" will be included with your template download. For a custom non-Google, no ads website search see
Burgdorf's WebSearch setup.