Hi there,
I was referred to this forum after unsuccessful attempt to resolve my issue from support ticket. Ticket reference number: 2487656.
I came across a problem in using hubL today, it seems like the issue caused by hubspot syntax (the double curly bracket).
Situation:
Trying to implement algolia into hubspot.
Problem:
One of the script syntax in algolia is using double curly bracket as a text to access the actual variable value. However, because hubL is using double curly bracket as variable, it is trying to process that curly bracket in hubL way, which resulting in ignoring it/outputing empty value.
Algolia script usage example:
search.addWidget(
instantsearch.widgets.infiniteHits({
templates: {
item: `<p>{{ object_key }}</p>` },
})
);
Expected result (in html):
<p>Key</p>
Actual result:
<p></p>
(Because object_key is non valid variable in hubL)
After dig in a little bit more. We can simplify the case by saying that hubL doesn’t allow double curly bracket as a text.
I tried to do a simple console log to print “{{” but it’s throwing me an error instead.
Sample code 1:
console.log(“I want to print {{.”);
Sample code 2:
console.log(“I want to print {{ . }}”);
In sample 1, it will return a syntax error saying “Uncaught SyntaxError: Unexpected token .”
Where as sample 2 will return "I want to print ".
Sample 2 can’t find the variable with dot in it, so it is showing empty.
My question would be:
Is there any way I can print double bracket as a text?
Say I want to console log “I want to print {{ }}”. How should I do that? I tried using {% raw %} for this, but I got no luck.
Looking forward to hearing from you.

