Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Services and Technology Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

Related Links

Google search at MIT

Add & restrict pages

Add a search box on your site

Additional Search Form Parameters

Update to Google v.4

Search appliance configuration

Collections

Search Results Stylesheet



MIT Google on your web site

Add a search box to your site

You can add a search box to your web site to help visitors find content on your site. You can restrict the search to a specified directory or search the entire MIT web site. The search box will look and behave like this:

Important: If you have created an MIT-Google search form in the past for your site, please note that the following instructions have been updated for Google v4 compability. Please see Migrating to Google v4 for additional details.

1. Insert the following HTML into your web page where you want the search box to appear (parameters in bold can be customized):

<form method='get' action='http://search.mit.edu/search'>
<input type='text' name='q' size='32' maxlength='255' value=''/>
<input type='submit' name='btnG' value='Search'/>
<input type='hidden' name='site' value='mit'/>
<input type='hidden' name='client' value='mit'/>
<input type='hidden' name='proxystylesheet' value='mit'/>
<input type='hidden' name='output' value='xml_no_dtd'/>

<input type='hidden' name='as_dt' value='i'/>
<input type='hidden' name='as_sitesearch' value='web.mit.edu/your_URL' />

</form>

  • An example of the your_URL format would be "web.mit.edu/newsoffice" or "itinfo.mit.edu". Do not use a final slash on your url.
  • Use single quotes as show in the code example above.
  • If you have been using the Infoseek search feature on your page, be sure to replace the complete Infoseek HTML section of your page with the complete Google HTML section above.

2. Customize the following parameters:

  • name='q' size='32'
    Sets the width (in number of characters) of the search box. You can change the size to suit your site's layout, but don't change the maxlength value.
  • name='btnG' value='Search'
    The text that appears on the search button.
    e.g.:
         
    "Search News Office")

If you want to restrict your search feature to a specific directory (and its subdirectories), include the following two parameters (as_dt and as_sitesearch).

If you want the search feature on your site to search the entire MIT collection, remove these two parameters from your HTML.

name='as_dt' value='i'
This setting determines whether your search should include or exclude the directory specified in 'as_sitesearch'. Values can be:

  • 'i' (include only results in the web directory specified by as_sitesearch)
  • 'e' (exclude all results in the web directory specified by as_sitesearch)

name='as_sitesearch' value='<yoururl>'
Pages in the specified directory will be included in or excluded from your search (according to the value of 'as_dt').
e.g.:

     name='as_sitesearch' value='web.mit.edu/newsoffice'

  • You must specify the complete canonical name of the host server followed by the path of the directory.
    e.g.: web.mit.edu/newsoffice not web/newsoffice

  • If the ("/") character is at the end of the web directory path specified, then only files within that directory will be searched and files in sub-directories will not be considered.
    e.g.:
          web.mit.edu/newsoffice to include sub-directories
          web.mit.edu/newsoffice/ to exclude sub-directories

  • as_sitesearch allows allows you to specify one directory (and all its sub-directories) as the domain to be searched—you cannot specify multiple disparate directories using this option

    (See additional parameters for options that allow you to specify multiple URLs, and information about requesting a collection.)

  • If you want the search feature on your site to search the entire MIT web site, delete this parameter.

name='proxystylesheet' value='mit'
This parameter specifies the stylesheet for the display of the search results.

The default MIT search site style includes the standard MIT navigation header, and provides options for People and Offices Directory search. If you would prefer to design and use your own search results stylesheet, see Using Custom Stylesheets.

[Back to top]

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.