Skip to main content

Implementation/Code

Northwestern uses Google CSE with a custom results page to allow searching across Northwestern subdomains. Choose one of the form options below to add search to your website. Please refer to the CSE guide or email webcomm-support@northwestern.edu for further customization.

Northwestern-wide Search

This code will search all Northwestern domains:


<form action="https://search.northwestern.edu/" method="get" role="search">
	<label class="hide-label" for="q-desktop">Search web or people</label>
	<input type="text" id="q-desktop" name="q" placeholder="Search web or people"/>
	<button type="submit">Search</button>
</form>

Search Within Site

This code will restrict (filter) results to a single site (in this example Web Communications):


<form action="https://search.northwestern.edu/" method="get" role="search">
	<label class="hide-label" for="q-desktop">Search this site</label>
	<input type="text" id="q-desktop" name="q" placeholder="Search this site"/>
	<input type="hidden" name="as_sitesearch" value="https://www.northwestern.edu/univ-relations/webcomm"/>
	<input type="hidden" name="sitetitle" value="Web Communications"/>
	<button type="submit">Search</button>
</form>

No client-side parameter escaping is necessary. If you are using the departmental template scripts.js, be sure to remove class="searchblox" from any surrounding markup.