Dynamic Page in Hubspot

Hi All,

Here is the thing I want.

I want a dynamic page where all the job description will be inserted in a database when user enter any data on editing website pages in hubspot and on page load data will be fetched in a form of accordian(please see the sample link below).

There would be a pagination and search option to search anything from accordian.

I have developed similar static page. Below is the link of this page.

https://www.workllama.com/find-jobs-0?hs_preview=asmCuKFQ-5322804910

However, becuase its a static page, each job rows are a custom module, search is just a google search instead of searching precisely from accordian. less and more button instead of pagination.

I need similar page with full dynamic functionality. Please help me with this.
Its seems HubDB is useful here but never used it and cannot image how to proceed with HubDB.

Also To use HubDB is it necessary for me to know HubL??

Help will be appreciated.

Thanks in Advance.

@SatyamSahay14,

The HubL docs are pretty useful. Here’s a handy tutorial doing exactly what you are wanting: Tutorial

Yes, you want to know HubL, but I don’t think anyone should be allowed to develop in Hubspot without knowing HubL. I have to clean up way to many messes. Luckily it is easier to learn than HTML, logically easier to learn Javascript, and the docs make it mostly copy and paste. If the HubL docs don’t do it for you check out the Jinja2 docs. It’s the same stuff, only HubL is personalized to Hubspot and not as inclusive. Also you can’t Python in Hubspot.

Thanks For replying.

The doc you sent on HubDB was really helpful.

Now I understood how to create table and fetch it through custom module in a page.

Now what I need is:
Front End - There would be a input field where user can search things from Table by click on search button.

Backend - filter as per user input and show only those rows which matches the search.

Also could you please provide doc for learning HubL in detail.

Thanks in Advance!

@SatyamSahay14,

You should be able to use some javascript to pass a query to your url, then use HubL to catch the query and filter your HubDB call by the query. Here is a blog I wrote that touches on queries only for blog filtering. It would look something like this:

html:

<form id="search_form">

 <input id="keyword" type="search" value="search">

 <button type="submit"></button>

</form>

Javascript&colon;

$(document).ready(function(){
 $('#searchform').submit(function() {

 var url = YourWebsiteListingPageURL;
 var searchTerm = $('#keyword').val().toLowerCase();
 var goUrl = url + '?q=' + searchTerm;

 window.location = goUrl;

 return false;

 });
});

HubL:

 {% set query = request.query_dict.q|lower %}

{% if query is defined %}

 {# filtered results #}

{% else %}

 {# regular results #}

{% endif %}

You will need to decided where to put these snippets.

As for learning HubL, If you understand basic programming (variables, conditional logic, expressions, etc.) then all your really missing is the syntax and terminology. You will only get that from the docs and trial and error. You can create a developers account and use it to practice, or what ever portal your allowed to use. I own a company with a portal and I still use a developer portal when playing around.

Just start here with Intro to HubL and work your way down the list on the left side. If you want some help you can PM me.

Hi,

Thanks for Reply.

Info was helpful.

Could you please let me know How to fetch q part from url using HubL?

Full URL is “https://www.nuvizzconsulting.com/-temporary-slug-5aa8be50-0560-49aa-bb47-a0de01456821?hs_preview=FxEXgdpd-5325053616?q=ashwini”

{{ request.query_dict }} gives me “{hs_preview=FxEXgdpd-5325053616?q=ashwini}”

{{ request.query_dict.hs_preview }} gives me “FxEXgdpd-5325053616?q=ashwini”

But {{ request.query_dict.hs_preview.q }} doesn’t give me anything. That is may be because q is not an object.

Please help me fetching q value i.e. ashwini through HubL.

Also is there any we can debug HubL code

@SatyamSahay14,

If you go to a page using the template you are building you will find “developer Info” in when you click on the little “sprocket” you find in the top right. That developer info is pretty helpful for debugging.

I don’t see in your url. Try working with a page in your content staging area instead of a preview page. That make for a smaller url.

From Developer Info

I have taken information from Developer Info only but as you can see and as I mentioned in my previous message request.query_dist.q is not working(its coming blank) as it is a part of a property and not a object. Then how to fetch that .q from url/property.

URL -

https://www.nuvizzconsulting.com/-temporary-slug-5aa8be50-0560-49aa-bb47-a0de01456821?hs_preview=FxEXgdpd-5325053616?q=ux%20designer

This is what I got as a output on the page:

Also I am using website pages preview link and not template to test.

@SatyamSahay14,

Ok sorry, I have been working double time lately and my focus has been blurry. I think I see the issue here, and it is actually something I myself should keep in mind.

I wrote this blog to try and help answer these types of questions without having to repeat myself.

Notice the section about queries has an example:

www.website.com/?attribute1=value1&attribute2=value2

Now look at your the url you shared:

www.website.com/?attribute1=value1?attribute2=value2

See the difference? it’s the & sign in the correct format vs the second ? in your example.

Here’s why:

The javascript I gave you assumes a clean url with no appendages. It passes the ? to the url because ? starts a query. Now this is absolutely correct in the cases I have beein using it because when search is clicked it directs them back to {{ group.absolute_url }} which is a clean url. When you go live with this you will want to do the same.

With your test url or a url with queries already attached you will need to modify the javascript&colon;

$(document).ready(function(){
 $('#searchform').submit(function() {

 var url = YourWebsiteListingPageURL;
 var searchTerm = $('#keyword').val().toLowerCase();
 var goUrl = url + '&q=' + searchTerm;

 window.location = goUrl;

 return false;

 });
});

I changed the “?” to “&”. Now when you use

{% set query = request.query_dict.q|lower %}

it should recognize “q” within your url and set the variable “query” to “q”'s value.