Add parameters to your HubSpot site search input module

    Difficulty Level: Intermediate. This post assumes a solid understanding of HubSpot tools and some technical knowledge. Instructions are detailed and can be applied as they appear on the post.

    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.

    Last Updated: November 6, 2019

    Thank you! I appreciate the feedback 😊

    Sorry to hear that! 🙁

    I'd appreciate if you could take a moment to let me know how I can improve this article.


    Looking for a HubSpot website developer?

    Let me help you with website themes, templates, page setup and custom modules. 

    Get in touch

    Not using HubSpot yet?

    HubSpot offers a free CRM as well as Marketing, Sales and Services tools (with free options too!) and a powerful CMS. Learn more here.

    Note, as a HubSpot affiliate I will get a commission if you click on the link above and end up purchasing an upgraded version. No pressure though!

    Stephanie O'Gay Garcia

    Hi! 👋 I'm a freelance HubSpot Website Designer & Developer based in Toronto (Canada). Give me a shout if you have questions about this post or there's anything I can help you with.