IT Web Development Help Pages

Search: Add Google Search to your Web site

Print this pagePrint this page

Questions should be directed to Web Development, it-webdev@udel.edu

Basic UD search

Effective July 2008, the University of Delaware will use Google search to provide search results for University Web sites. All search forms on Web sites that reference the old search will need to be updated. Below is the new HTML code for a basic search form:

<form method="get" action="http://gsa1.udel.edu/search" name="search">
  <input type="text" name="q" size="20" maxlength="256" />
  <input type="submit" name="btnG" value="Search" /> 
  <input type="hidden" name="site" value="UDel">
  <input type="hidden" name="client" value="default_frontend" />
  <input type="hidden" name="output" value="xml_no_dtd" />
  <input type="hidden" name="proxystylesheet" value="default_frontend" />
</form>

The code above would produce the following search form:

Alternatively, a pull-down menu can be inserted to provide an option for "UD" and "UD + Archives".

<form method="get" action="http://gsa1.udel.edu/search" name="search">
  <input type="text" name="q" size="20" maxlength="256" />
  <select name="site">
    <option value="UDel" selected="selected">UD</option>
    <option value="UDel_archive">UD + Archives</option>
  </select>
  <input type="submit" name="btnG" value="Search" />
  <input type="hidden" name="client" value="default_frontend" />
  <input type="hidden" name="output" value="xml_no_dtd" />
  <input type="hidden" name="proxystylesheet" value="default_frontend" />
</form>

The code above would produce the following search form:

Site-specific search

To limit the search to only one URL, add an additional hidden field with the name of "sitesearch" and replace the value with the address of your web directory. The example below will only search pages that have http://www.udel.edu/help as the root URL. At the same time, you should change the value of the submit button to indicate that the form is performing a site-specific search.

<form method="get" action="http://gsa1.udel.edu/search">
  <input type="text" name="q" size="20" maxlength="256" value="">
  <input type="submit" name="btnG" value="Search this site">
  <input type="hidden" name="site" value="UDel">
  <input type="hidden" name="client" value="default_frontend">
  <input type="hidden" name="output" value="xml_no_dtd">
  <input type="hidden" name="proxystylesheet" value="default_frontend">
  <input type="hidden" name="as_sitesearch" value="http://www.udel.edu/help">
</form>

The code above would produce the following search form:

Site-specific and UD searches on pull-down menu

If you would prefer to give users the option to search just your Web site or all of UD, use the lines of code below to include a pull-down menu search option:

<form method="get" action="http://gsa1.udel.edu/search" name="search">
  <input type="text" name="q" size="20" maxlength="256">
  <select name="sitesearch">
    <option value="http://www.udel.edu/help" selected>Search this site</option>
    <option value="">UD</option>
  </select>
  <input type="submit" name="btnG" value="Search">
  <input type="hidden" name="site" value="UDel">
  <input type="hidden" name="client" value="default_frontend">
  <input type="hidden" name="output" value="xml_no_dtd">
  <input type="hidden" name="proxystylesheet" value="default_frontend">
</form>

The code above would produce the following search form:

Site-specific and UD searches on radio buttons

Alternatively,you can provide search an option to search your site or all of UD via radio buttons, as shown in the following example:

<form method="get" action="http://gsa1.udel.edu/search" name="search">
  <input type="text" name="q" size="20" maxlength="256">
  <input type="submit" name="btnG" value="Search"><br />
  <input type="radio" name="as_sitesearch" value="http://www.udel.edu/help" checked>Search this site</input>
  <input type="radio" name="as_sitesearch" value="">UD</input>
  <input type="hidden" name="site" value="UDel">
  <input type="hidden" name="client" value="default_frontend">
  <input type="hidden" name="output" value="xml_no_dtd">
  <input type="hidden" name="proxystylesheet" value="default_frontend">
</form>

The code above would produce the following search form:


Search this site UD

Additional options

We also suggest utilizing a robots.txt file in your main directory to help the search engine determine appropriate indexing. Learn more about robots.txt.

Questions about UD's Google search may be directed to the Help Center at (302) 831-6000, or submit a Help Ticket Request form.