Access Keys:
Skip to content (Access Key - 0)

MIT Google - Add a Search Box to Your Site

On this page:

Add a Simple Search Box

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

  1. Insert the following HTML into your web page where you want the search box to appear (parameters in bold can be customized):
    <div><form method="get" action="">
    <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="ie" value="UTF-8"/>
    <input type="hidden" name="as_dt" value="i"/>
    <input type="hidden" name="as_sitesearch" value="your_URL"/></div>
    An example of the your_URL format would be or Do not use a final slash on your URL.

  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")
    • name="as_sitesearch" value="your_URL"
      Searches will only include pages in the specified directory e.g., name="as_sitesearch" value=""
      • You must specify the complete canonical name of the host server followed by the path of the directory.
        E.g., 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., to include sub-directories to exclude sub-directories
      • as_sitesearch 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. If your site spans multiple sites or directories, contact the MIT-Google Team.
      • If you want the search feature on your site to search the entire MIT website, delete the as_sitesearch and as_dt parameters.
    • 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.

Additional Search Box Parameters

For further information on additional search parameters consult the Google Search Protocol Reference, which documents all the supported search parameters in detail.

Related Links

Google Search Engine at MIT
Add and Restrict Pages
Custom Stylesheets
Handling Redirection When Your Site Moves
Secure Search

IS&T Contributions

Documentation and information provided by IS&T staff members

Last Modified:

March 03, 2016

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
crawlingschedule crawlingschedule Delete
google google Delete
indexpages indexpages Delete
m-hermes m-hermes Delete
search search Delete
webresources webresources Delete
c-web-publishing c-web-publishing Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
This product/service is:
Easy to use
Difficult to use

This article is:
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki