HubL is a templating language used in the HubSpot CMS, HubL is a sub-set of Jinja.
Questions tagged [hubl]
17 questions
5
votes
0 answers
Language switching in Hubspot CMS
What is the best way to make custom language switcher to the site.
My problem is that I have a site with two language versions and my custom language switcher is a bit problematic I would say. It doesn't work in all pages for some reason and in my…

Nahka
- 416
- 1
- 6
- 16
2
votes
2 answers
Find difference between todays date and time to another date and time
I'm trying to find the date and time difference between two dates (and times). I'm trying to implement a countdown (to the event date) feature but coming across issues with my approach.
Note: Some of the variables defined below are in HuBL, HuBL can…

Freddy
- 683
- 4
- 35
- 114
2
votes
1 answer
Is it possible to share HubL macros across modules and templates?
In the HubSpot CMS, you can create a macro like so:
{% macro render_section(classes, background_style) %}
{{ caller() }}
{% endmacro %}
Is it possible to share…
random_user_name
- 25,694
- 7
- 76
- 115
1
vote
0 answers
Display one featured post(that is most recent), followed by Recent posts(Hubspot)
I'm currently working on a Blog Listings page. I'd like to display one Featured post at a time, and up top before other posts. And in order to test this out, I created a couple of Test blogs. One is with another Featured tag.
So my blog listings…

Jess Y.
- 19
- 2
1
vote
1 answer
Comparing two arrays, checking for matching values
Using HubL (as I'm building a module in HubSpot), I have two arrays:
topics : Which is a list of topics.
all_tags: Which is an array of all the blog tags in the system.
If I dump out these arrays, this is what it will return:
{{ topics }} prints…

Freddy
- 683
- 4
- 35
- 114
1
vote
2 answers
HuBL / Twig: For loop repeating same content (alternative to break needed)
I'm using a for loop to generate cards for each blog post that exists in the system.
The cards generated will have varying widths. A card can be large or small and to achieve this, I'm using HubL's cycle syntax (doc here). A visual example of the…

Freddy
- 683
- 4
- 35
- 114
0
votes
1 answer
HubdB Column Data Can't Be Retrieved in a Gallery Slide Block Syntax
Hopefully, the HubSpot developers here will be nice.
I’m trying to retrieve rows data from a hubdb table like this:
{% set gallery = hubdb_table_rows(, "__contains=") %}
{% if gallery == [] %}

Cephas
- 1
- 3
0
votes
1 answer
adjusting the position of image in hubl template
I am new to hubl code template development.. I am looking for some way to adjust the position of image in the same template.. I want image to go slightly out of screen for the same wanted to "object-fit" property of css.. but I am stuck with adding…

Shruti
- 721
- 3
- 13
- 31
0
votes
1 answer
Filtering data from fetch() into matching container
I'm using fetch() to create a section which pulls and sorts listings from greenhouse api into its matching container.
I have a predefined list of departments which I have stored in the departments array. If a fetched item has a similar value as the…

Freddy
- 683
- 4
- 35
- 114
0
votes
1 answer
Is it possible to replace the social media icons in HubSpot's codebase?
I am new to this platform and the syntax. We have custom social media icons in our theme. Example:
I…

Lili
- 333
- 4
- 23
0
votes
1 answer
Run for loop to show posts, but make 3rd card always show post with specific tag
This question is regarding HubSpot/HuBl, but I am also tagging twig as the syntaxes are similar.
I have a blog layout containing 7 cards and has the following structure:
For reference, the class modifiers for the above…

Freddy
- 683
- 4
- 35
- 114
0
votes
0 answers
HubL / Twig : Comparing two unix timestamps
I'm trying to find the date and time difference between two unix values. In HuBL, I have currently:
{% set event_date_and_time = table_data_dict.event_time|unixtimestamp %}
{% set current_time_and_date = local_dt|unixtimestamp %}
{% if…

Freddy
- 683
- 4
- 35
- 114
0
votes
1 answer
HuBL: How to check what lists a contact is part of by contact ID?
I'm trying to show specific content if a user is part of a list in HubSpot.
Psuedo:
If contact_id is part_of_this_list then do this
The contact ID at the moment is being obtained from the query string. I'm trying to check if the user is part of said…

Freddy
- 683
- 4
- 35
- 114
0
votes
2 answers
Getting cookie as a HubL variable
In HubSpot I'm trying to check if a cookie exists, if it does exist, I'm looking to perform an action through an if statement. However, I cannot seem to get the cookie value using request.cookies as outlined in their docs.
Doing the following:
{%…

Freddy
- 683
- 4
- 35
- 114
0
votes
1 answer
HuBL: Using for loop variable outside for loop
I have created a template partial file where I'm defining all variables in that file. I then want to reference a variable in custom modules. However, the for loop loop closes in the partial file, so when I reference it in the HTML of a custom…

Freddy
- 683
- 4
- 35
- 114