Digital.gov Guide
Optimizing site search with Search.gov
Optimize your content
There are many options to optimize your content, so you may need to consult your content team for help.
Optimize your content for search engines
Search.gov follows search engine optimization (SEO) best practices.
Create a robots.txt file and XML sitemap to optimize your search results.
Also make sure to include a HTML page title and meta page description for every page of your website. These elements are important for accessibility and discoverability.
HTML page titles are often used by search engines as the link to your web page from search results. They also appear at the top of a browser tab. They’re often the first item read by screen readers when visiting a web page.
The meta description will often appear in search results pages instead of a snippet of page content. The description, along with the HTML page title, helps a person decide whether or not to click a search result.
Add your domains
Add your domains on the Domains page in the Admin Center.
For the most comprehensive results add yoursite.gov without the www. This returns search results for all content across your domain, including all subdomains and folders.
For more precise results, you can be more specific:
- Add www.yoursite.gov to return results for content under your “www” domain only
- Add subdomain.yoursite.gov to return results for content under this subdomain only
- Add yoursite.gov/folder to return results for content under this folder only
For more precise results, you can also exclude content. Examples include:
- Add subdomain1.yoursite.gov, subdomain2.yoursite.gov, and subdomain4.yoursite.gov to return results for content under these subdomains only (and not subdomain3.yoursite.gov)
- Return a 404 Not Found or 301 Moved Permanently HTTP response code for all pages you remove from your website
- Disallow subdomains or folders in your robots.txt file
Note that Search.gov indexes publicly accessible content only. Do not add domains for secure content, including intranets.
Update your robots.txt
Make sure your robots.txt file allows the Search.gov user agent (usasearch) to access your content. Also add their IP addresses (23.22.149.231 and 35.169.255.4) to your allowlist.
Troubleshooting tips
Don’t see what you expect? If your search results include unexpected pages, are missing pages, or are not returning any results, consult your technical team. Ask them to:
- Review the set up on the Domains page in the Admin Center
- Check your robots.txt file and XML sitemap to make sure they're properly configured
- Confirm the status codes on your web pages
- Confirm your site allows the Search.gov user agent and IP addresses
Then, if you still have issues, email the Search.gov team for support.
Manage other content (optional)
Search.gov offers several other ways to manage the content on your results page. You can set up collections and best bets in the Content section of the Admin Center.
Create collections
You can use collections to search a narrower or broader scope than the default results page defined by the domains you added.
Add a name for the collection (such as Blog, News, or All Agency) to create a collection. Then, add the scope:
- To search a narrower scope, add the subdomain or folder (such as blog.yoursite.gov or yoursite.gov/news/ for the Blog or News collections).
- To search a broader scope, add the domains (such as bureau1.gov, bureau2.gov, bureau3.gov for the All Agency collection).
Collections often appear as a tab on your search results page. After you create a collection, be sure to turn on its display on the Display Overview page in the Admin Center.
You can also set up a separate search box on your website that limits results to the collection only. Check out the tips on how to set up a search box limited to a collection only.
Recommend content with best bets
You can use best bets to recommend and promote specific pages at the top of your search results page.
Best bets stand out from the regular web results with some unique formatting and a title, Recommended by YourSiteDisplayName.
To create a best bet:
- Add the page URL.
- Add a title and description. Titles and descriptions are displayed on the results page. Each field can have up to 255 characters.
- Set the status and publish date. Newly created best bets are active by default. Change it to inactive if you don’t want it to be displayed yet. Use the start and end dates if you only want the best bet to appear during a specific timeframe.
- Add keywords (optional). Keywords do not appear on the results page. Use them to add other words or phrases that are not in title or description. Common keywords include acronyms, synonyms, misspellings, slang, or other variants.
If multiple best bets are returned for search, only the two most relevant best bets are displayed.
Search for vote on USA.gov to see an example of a best bet on a federal government website.