Last modified: August 22, 2025
Site search functionality allows your visitors to search your website for specific content. All of content hosted on HubSpot is automatically indexed in HubSpot’s search engine.
Searching Content
The search engine is accessible through the site search API. This API supports numerous filtering options to allow you to create a highly customized and powerful search experience on your website. For example, if you wanted to build a search into your blog, you can query fortype=BLOG_POST to only return blog posts. Or, if you wanted to build search into the Spanish version of your website, you could query language=es to only return Spanish pages.
The API returns JSON that can be parsed with JavaScript to display the results on your website. All content types will return the page domain, title, url and language. The description returned is a sample of text from the content which best matches the search term. A <span class="hs-search-highlight hs-highlight-html"> element will wrap perfectly matching text, allowing you to highlight matching text with CSS.
Depending on the type of content searched, the results return slightly different information, so you can display results for unique content types differently. For example, blog posts will return information on which tags the post has, who the author is, and when it was published.
Implementing search on your website
There are two default modules you can use to easily implement search on your website, which use the site search API:search_input and search_results.
Site Search Input
An input field for visitors to enter search terms into. This module can exist anywhere on your website. This module can be included in a template with{% module "search_input" path="@hubspot/search_input" %}.
Site Search Results
Returns a listing of content based on the search term. This module can exist anywhere on your website. This module can be included in a template withhs fetch @hubspot/search_input.module or hs fetch @hubspot/search_results.module.

Search Results Template
Every domain has its own search results page by default. The template and path for this page are set at Settings > Website > Pages under the System Pages tab for specific domains. See the CMS theme boilerplate search results template as an example. The domain set for the search results page is automatically connected to the default search modules. However, you can use the site search API to build our your search results as you’d like on any pages of your website.How is the search precedence determined?
The order of search results is determined by a series of weighted comparisons of page content to the visitor’s search term. Page content is separated into comparison fields with varying weight based on where the content lives within the HTML of your pages. Comparison fields are grouped in order of weight:- HTML title
- Meta description
- H1 HTML elements
- H2 HTML elements
- H3 HTML elements
- Other HTML elements
hs-search-keyword class.
Control indexing during development
While developing a new site, it’s useful to be able to test site search without worrying about the site being indexed by search engines such as Google. In yourrobots.txt you can tell HubSpot to crawl everything, while blocking other bots.
Default indexing behavior
Because the CMS knows the intent of certain types of pages, content search is able to safely limit indexing to allow indexing of content type pages. Examples of content type pages:- Site Pages
- Landing Pages
- Knowledge articles
- blog posts
How can I exclude pages from being returned in search results?
If you block a page from being indexed to search engines via your websitesrobots.txt file or via meta tags, they will not be indexed for site search.
In your robots.txt add a disallow.
NOINDEX, NOFOLLOW meta tag in the <head> at the page or template level.
How to exclude sections of a page from being indexed in search
Sometimes there are regions of a page that are not useful to return in search results. This might be content from a header, a footer, sidebar, etc. When this is the case, you can add the classhs-search-hidden to your HTML for those regions to have search ignore the content inside.