CMS Development

adeelfaisal
Member | Platinum Partner
Member | Platinum Partner

Faceted or advanced search in HubSpot CMS

Hi everyone, 

 

We want to build a faceted or advanced search in HubSpot blog. It's not available natively. Is there any workaround or solution to use HubDB or custom code to build that. 

Any help or lead would be highly appreciated. 


Adeel Faisal
Direct of Growth @ 3 & Four

Did my post help answer your question? Help the community by marking it as a solution.
0 Upvotes
5 Replies 5
sharonlicari
Community Manager
Community Manager

Faceted or advanced search in HubSpot CMS

Hey @adeelfaisal 

 

I apologize for the delay answer, could you please share the URL you are working on. This will help the experts I will tag so they will be able to advise you.

 

Hey @DanielSanchez @daveroma  could you please share your knowledge with @adeelfaisal ?   

 

Thank you

Sharon 


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




adeelfaisal
Member | Platinum Partner
Member | Platinum Partner

Faceted or advanced search in HubSpot CMS

Thanks @sharonlicari for your response. 

 

We don't have the search on the live website at the moment but here is a good example of what we are trying to achieve https://www.hubspot.com/agencies. Please check the search and filtration option here and please tag the relevant experts.

Thanks in advance 


Adeel Faisal
Direct of Growth @ 3 & Four

Did my post help answer your question? Help the community by marking it as a solution.
0 Upvotes
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Faceted or advanced search in HubSpot CMS

@adeelfaisal 

If you build a HubDB database you can leverage the request.query_dict tag to grab query parameter values from your URL and if statements to build out a filter parameter for your table on selection of any of your filter/search options. A little example :

{% set filter = "" %}

{% if request.query_dict.searchquery %}
    {% set filter = filter~"&columnname__contains="~request.query_dict.searchquery|urlencode %}
{% endif %}

{% if request.query_dict.filterone %}
    {% set filter = filter~"&columnname="~request.query_dict.filterone|urlencode %}
{% endif %}

{% set table = hubdb_table_rows(dynamic_page_hubdb_table_id, 'orderBy=name'~filter) %}


Then if you also want separate pages for specific filters (as done on the Industries, Services, and Coutnries filters in the page you linked to) you can create a template with a module field option to choose which option to filter the page with and add them to the code above like so :

{% if module.filter_name %}
    {% set filter = filter~"&columnname="~module.filter_name|urlencode %}
{% endif %}

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
adeelfaisal
Member | Platinum Partner
Member | Platinum Partner

Faceted or advanced search in HubSpot CMS

Thanks a lot @alyssamwilie for your response. 

 

We are actually looking to have this search filters on blog listing page. Please let me know if this will work there using tags and keywords? Or if there is a workaround for that?


Adeel Faisal
Direct of Growth @ 3 & Four

Did my post help answer your question? Help the community by marking it as a solution.
0 Upvotes
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Faceted or advanced search in HubSpot CMS

@adeelfaisal 
You can definitely do something similar with blog posts!

The following community post actually goes pretty in depth on how to create a filter from a query param set by a dropdown to filter a blog listing.

https://community.hubspot.com/t5/CMS-Development/Create-a-blog-filter-for-resource-type/td-p/23247#U...

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.