Skip to Content

Add parameters to your HubSpot site search input module

⚠️ Note that this post hasn't been updated for at least a year and the information may be outdated, proceed with caution! (Last updated: November 6, 2019)

You can customise the site search module on your HubSpot account to include additional parameters in your search, such as the content type or language. 

Where do I find the HubSpot site search module?

If you navigate to Marketing > Files and Templates > Design Tools you'll see a search bar in the upper left-hand corner that lets you search through your design templates, files and modules: 

HubSpot Design Tools - Search Assets

Enter "Site Search Input" and you should find the file under the "DEFAULT MODULES" folder.

While you can't make updates to default modules, you can click on the "Clone module" button to create your own version:

Site Search Input - Clone Module

How do I customise the site search parameters?

In the module HTML + HubL section, you'll find several input tags. The first input tag (the one with class="hs-search-field__input") is the actual search bar. However, you can add additional input tags below to add parameters. 

Default parameters

HubSpot already include module options to choose the content type and, depending on which have been selected, will add in parameters for content types: 

Site Search Input - Type Parameters

Custom parameters

You can add in parameters below the ones in the above screenshot by adding in a new input tag, setting the type to "hidden", setting the name to the parameter you would like to use and the value to the parameter's value. 

For example, to specify that only Spanish pages should be searched, you would add this input tag:

<input type="hidden" name="language" value="es">

And to specify that only a specific blog should be searched, you would add in this input tag, where "12345" is the HubSpot blog ID

<input type="hidden" name="groupId" value="12345">

The next section contains a list of the available parameters and what to use for the "name".

Available parameters

You can add in parameters below for the following: 

  • Type (name="type"): Specifies the type of content to search. Can be one or more of SITE_PAGELANDING_PAGEBLOG_POSTLISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE
  • Domain (name="domain"): Specifies the domain(s) to be searched. Can be one or more of the portal's connected domains. Defaults to all domains.
  • Language (name="language"): Specifies the language of content to be searched. This parameter should obey the ISO639-1 format (e.g. es for Spanish).
  • Property (name="property"): Specifies which properties to search for (defaulting to all properties). Options are title, description, and html. For blog posts, additional search properties are author_full_name, author_handle, and tag.
  • Group ID (name="groupId"): Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog.
  • Table ID (name="tableId"): Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the hubdbQuery parameter to further filter results.
  • HubDB Query (name="hubdbQuery"): Specify a HubDB query to further filter the search results. Used in tandem with the tableId parameter above.
  • Path Prefix (name="pathPrefix"): Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times.
  • Match Prefix (name="matchPrefix"): Inverts the behavior of the pathPrefix filter when set to 'false'. (Defaults to true)

A full list of parameters is available on HubSpot's API documentation.

←  Previous Article

Where to find your HubSpot blog ID

Next Article  →

Add a "Forward to a Friend" link to HubSpot emails

Contact

Get help from a HubSpot CMS Expert

  • Custom HubSpot themes and reusable and easy-to-use HubSpot templates and modules
  • Technical support and guidance on the HubSpot CMS