APIs & Integrations

cmcgarry
Member

Handlebars in a template

SOLVE

Hey there fellow HubSpotters,

I built a job listing page using JobVite API. It works great locally, I went to embed it within a template and it turns out that {{ }} is used by HubSpot and Handlebars. So I figured, no problem, I can just change the delimiter, no dice, Handlebars doesn’t support it, a change of delimiter.

So, now I’m stuck and need to get this integration in place pronto. Has anyone figured a workaround for this? I realize I may have to fall back to mustache but hope not.

Sample of the template:

{{#each this}}
	<li class="career" id="divider" data-category="{{category}}" data-location="{{locationCity}}" data-index="{{eId}}">
<figure>
<div class="locationSmallBlk">{{locationCountry}}</div>
<div class="locationBigBlk"><a href="{{eId}}">{{locationCity}}</a></div>
<div class="openingsBlk">{{category}}</div>

<figcaption>
<div class="locationSmall">{{locationCountry}}</div>
<div class="locationBig"><a href="{{eId}}">{{locationCity}}</a></div>
<div class="openings">{{category}}</div>
</figcaption>
</figure>
</li>
	{{/each}}

Any suggestions would be greatly appreciated.

Thank you!

0 Upvotes
1 Accepted solution
cmcgarry
Solution
Member

Handlebars in a template

SOLVE

HubSpot tech support pointed me to:

Escaping HubL delimiters

Many other languages share the same delimiters as HubL, which can create issues when working in coded files on the COS. If you want to use a HubL delimiter for a different language, you need to wrap that code in:

{% raw %} {{Code you want to escape}} {% endraw %}

View solution in original post

0 Upvotes
4 Replies 4
cmcgarry
Solution
Member

Handlebars in a template

SOLVE

HubSpot tech support pointed me to:

Escaping HubL delimiters

Many other languages share the same delimiters as HubL, which can create issues when working in coded files on the COS. If you want to use a HubL delimiter for a different language, you need to wrap that code in:

{% raw %} {{Code you want to escape}} {% endraw %}
0 Upvotes
Not applicable

Handlebars in a template

SOLVE

Awesome find, thanks for sharing!

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Handlebars in a template

SOLVE

@cmcgarry Great find! thanks for updating the forum.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Handlebars in a template

SOLVE

@cmcgarry HubSpot uses the {{}} for our templating language HubL. This is something you cannot change. Is there a reason you need Handlebars? Have you taken a look at HubL to see if you can recreate what you are trying to accomplish from there?