Skip Navigation
PrintPrint version

Search Code For Municipalities

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 edits to these lines of the code:

    1. <input type="hidden" name="site" id="site" value="your_collection">

      <input type="hidden" name="r" id="r" value="your_collection" />

      Replace "your_collection" with the collection corresponding to your site. To find the collection corresponding to your site, please click "What is my collection?"

      E.g.: If your site or domain is "www.town.amherst.ns.ca" then your collection would be "NSMUN_AMHERST"

    2. <input type="hidden" name="h" id="h" value="your_domain" />

      Replace "your_domain" 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.: www.town.amherst.ns.ca/

      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.

    3. <input type="hidden" name="i" id="i" value="your_header_image" />

      Replace "your_header_image" with a name of an image that you will use as a header for the top of your page. This image must reside on the root of your directory; it may not be kept in an images folder or any other folder off the root.

      E.g.: "askjoehowe2750.jpg" - This is the name of the image header at the top of this page.

    4. <input type="hidden" name="t" id="t" value="your_header_image_height" />

      Replace "your_header_image_height" with the height of "your_header_image" (as described above).

      E.g.: "750" - This is the width of the image header (askjoehowe2750.jpg) at the top of this page.

    5. <input type="hidden" name="w" id="w" value="your_header_image_width" />

      Replace "your_header_image_width" with the width of "your_header_image" (as described above).

      E.g.: "50" - This is the height of the image header (askjoehowe2750.jpg) at the top of this page.

  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)

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