Skip Navigation
PrintPrint version

Basic Search Code Using the Site Search Parameter

Basic "Search this Site" Code

To add a basic "search this site" form to your site, you need only add the following form code to your site with a few modifications:

  1. First, copy the following code and paste it into a blank HTML document.






  2. Next, make the following edit to this line of the code:

    1. <input type="hidden" name="sitesearch" value="www.gov.ns.ca/yourdirectory"/>

      Replace "www.gov.ns.ca/yourdirectory" with the URL of your site. Please note: if your site is using a virtual domain (e.g.: museums.gov.ns.ca), use your virtual domain here.

      Do not add a trailing slash (colored in red in the example below) after the URL

      E.g.: http://www.gov.ns.ca/yourdirectory/

      If you do, Google will limit its search to just the files in the root of your site and so files in subdirectories of your site will not be found.

    2. <input type="hidden" name="client" value="your_frontend"/>

      <input type="hidden" name="proxystylesheet" value="your_frontend"/>

      Replace "your_frontend" with a frontend that corresponds to your department or agency.

      What is my frontend?

  3. Additional (optional) edits you can and cannot make:

    1. You can change the size of the search input box (it defaults to "40.")

    2. You can add an image for the search button, but do not change the name="btnG" parameter.

    3. You can use a table to control the layout of the form, but do not break up the form into separate tables or the code will not work.

    4. You can use style sheets to control the layout of the form (recommended over using tables)

    5. See the instructions on customizing for more.

  4. Upload your form code and test it out. Search results should be within your site.