Handlebars in a template


#1

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!


#2

@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?


#3

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 %}

#4

@cmcgarry Great find! thanks for updating the forum.


#5

Awesome find, thanks for sharing!