Expand my Community achievements bar.

Dive in, experiment, and see how our AI Assistant Content Accelerator can transform your workflows with personalized, efficient content solutions through our newly designed playground experience.

ajo variables

Avatar

Level 4

How can I pass an HTML tag as a variable in AJO?

I want to declare a variable that contains a hyperlink. For example:

{% let abc = "<p>hi this is my url <a href=\"https://www.google.com\">Google</a></p>" %}

However, when I display this variable in my Handlebars template, I'm getting an unexpected output, such as:

"Hi this is my url <p>hi this is my url <a href="https://www.google.com">Google</a></p>"

Questions:

How can I correctly handle HTML tags in a variable?
How can I properly include quotes (") in the variable declaration?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Community Advisor

Hi @Ajo_WisdomChase 

AJO is using Handlebars as interpreted. To correctly handle HTML tags in a variable using Handlebars, you need to use triple curly braces ({{{ variable}}}). This tells Handlebars not to escape the HTML characters, allowing the HTML code to be rendered as part of the final output.

You're doing the escaping correctly when definig your variable abc.

 

Please try {{{abc}}}

 

Thanks,

David



David Kangni

Avatar

Administrator

Hi @Ajo_WisdomChase,

Was the given solution helpful to resolve your query or do you still need more help here? Do let us know.

Thanks!



Sukrity Wadhwa

Avatar

Level 4

Hi @DavidKangni @Sukrity_Wadhwa 

 

I'm encountering an error while using triple curly braces {{{variable}}}. Could you please help me? Ajo also added " " quotes at the beginning and end.

 

Ajo_WisdomChase_0-1730202366580.png