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:
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:
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.
HubSpot already include module options to choose the content type and, depending on which have been selected, will add in parameters for content types:
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".
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
KNOWLEDGE_ARTICLE. Defaults to all content types except
- 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
html. For blog posts, additional search properties are
- 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
hubdbQueryparameter to further filter results.
- HubDB Query (name="hubdbQuery"): Specify a HubDB query to further filter the search results. Used in tandem with the
- 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.Last Updated: November 6, 2019