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.
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.
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.
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.
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.