Would you like searchers to be able to change where they are searching, either to a particular place within your site, or to another site? You can create a collection that will search in any set of domains, subdomains, or subfolders.
Step 1. Create a Collection
Enter a name for the collection (such as FAQs, Archive, or News).
Enter the domains, subdomains, or subfolders that you want this collection to search in. Start each URL prefix with http:// and end it in a trailing slash to avoid unintended matches (e.g., https://publications.agency.gov/docs/ and https://answers.agency.gov).
You cannot specify URLs for individual web pages. If you are including a subfolder, be sure to include the folder(s) where the files are actually stored, not the folder where the index page lives.
Paths that are three or more subfolders deep may not return results immediately. Email us if you are not seeing search results for these paths.
Step 2. Opt to Show as a Facet
Click on the Display Overview page. Turn on your collection to allow searchers to see it as a search facet in the navigation bar above the search box on the results page (in the desktop view), or in the search menu (on smaller screens).
Step 3. Check Your Search Results Page
Searchers will see the collection name as an option that they can select in order to focus their search.
Did you know? You can set up a search box on your website that limits results to your collection.
- Start with the standard form snippet on the Code Snippets page under the Activate Search tab.
- Change the form action from
- Add the following line to limit the results to your collection:
<input type="hidden" name="dc" value="###">.
The value is the number for your collection ID, which is visible in the URL when you edit your collection in the Admin Center.
See the sample search box below that is limited to news on NIH.gov for a search on autism.
Did you know? If you don’t want to set up a Collection, you can use the
sitelimit parameter to search a subset of your content. Compare the collection-based results above with the results for the same search using the sitelimit parameter.
Note that the searcher sees that results are filtered to nih.gov/news in a message under the search box, among other differences.
Simply add the following line to your form code on your search box to use the
<input type="hidden" name="sitelimit" id="sitelimit" value="www.agency.gov/limittothisfolder">