2022.2

Table Of Contents
HandlebarsisthenameofaJavaScriptlibrarythatimplementsatemplatinglanguage(see
https://handlebarsjs.com/).Itusesatemplateandaninputobjecttogenerateoutput.
ThetemplatelookslikeregulartextwithembeddedHandlebarsexpressions.Ahandlebarsexpression
issomecontentsenclosedbydoublecurlybraces:{{...}}.Forexample:
<p>Hello {{firstname}}!</p>
Whenthetemplateisrendered,theseexpressionsarereplacedwithvaluesfromaninputobject.
TheHandlebarslibraryisintegratedinOLConnectDesigner.ThismeansthatyoucanuseHandle-
barsexpressionsinallsections(asofversion2022.2),aswellasinaspecialtypeofsnippetscalled
"Handlebarstemplates"(asofversion2022.1).
ThebigadvantageofusingHandlebarssnippetsinOLConnectisthatonlyoneortwoverysimple
Designerscriptsareneededtoreplaceapotentiallylargenumberofexpressionswithvaluesandinsert
thecontentinasection.ThisisespeciallybeneficialforOLConnecttemplateswithmanysnippetsand
variabledatathatwouldotherwiserequirealargenumberofscripts.
WorkingwithHandlebarstemplatesinvolvesalittlebitofscripting.Ifyouarenewtoscriptinginthe
Designer,firstread:"Writingyourownscripts"onpage808.
Note: TheinformationinthisOnlineHelpfocusesontheimplementationofHandlebarsinOL
Connect.ForgeneralinformationaboutHandlebarsandhowtouseit,seethefollowingweb
sites:https://handlebarsjs.com/andhttps://devdocs.io/handlebars.
CreatingaHandlebarstemplate
Tocreateanew,emptyHandlebarstemplate:
1. OntheResourcespane,right-clicktheSnippetsfolderandselectNew Snippet.
2. Selectthetypeofsnippetthatyouwanttocreate:Handlebars template.
3. Givethesnippetaname.
4. Double-clickthenewfiletoopenitintheDesignerandfillitwithHTMLtextandHandlebars
expressions.
TheeditorforHandlebarssnippetsdoesnothaveaDesignview.HTMLwithHandlebarsexpressionsis
notnecessarilyvalidHTML.ProcessingitwithanHTMLparsermightbreakboththeHandlebars
expressionsandtheHTML.
Moreaboutexpressionsandthefunctionsthatyoucanuseinexpressionscanbefoundinthetopics
"Handlebarsexpressions"onpage763and"Usingfunctionsinexpressions:Helpers"onpage766.
Page 666