2022.2

Table Of Contents
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partial
AnyHandlebarstemplate,includingremoteHandlebarstemplates,canbeusedasapartialinaHandle-
barstemplate(snippet)inOLConnect.
TocreateapartialinanOLConnecttemplate,simplycreateanewHandlebarstemplate;see"Creating
aHandlebarstemplate"onpage775.
Tip: TokeepanoverviewyoucouldgroupthepartialsinasubfolderoftheSnippetsfolderon
theResourcespane.
Howtoregisterapartial
Itisnotmandatorytoregisterapartial,butitcanbeuseful,forexampleifyouwanttoworkwith
dynamicpartials.RegisteredpartialscanbereferredtoinHandlebarsexpressionsandfunctionsbythe
specifiedname;see"Usingaregisteredpartialinatemplate"onthenextpage.
Toregisterapartial,usethefollowingfunctioninascript:Handlebars.registerPartial('partialName',
'template')(fordetailssee:"HandlebarsAPI"onpage780).
Forexample,thislineofcoderegistersatemplate(clauses.hbs)asapartialwiththename'clauses':
Handlebars.registerPartial('clauses', 'snippets/partials/clauses.hbs');
Tip: PartialsregisteredinaControlScriptwillbeavailableinallstandardscripts.ControlScripts
areexecutedfirst.(See"ControlScripts"onpage838.)
Note: RegisteringmultiplepartialswithasinglecallisnotsupportedinOLConnect.
UsingpartialsinHandlebarstemplates
ToincludeapartialinaHandlebarstemplate,insertanexpressionthatreferstoit,forexample:
{{> partialname.hbs}}.
Relativepaths(startingwithsnippets/)andarbitraryURLs(startingwithfile://orhttp://orhttps://)are
supported.
Thefilenamecanbe:
l
thenameofan.hbssnippetinthetemplate(forexample:{{> snippets/Snippet 1.hbs}}
l
thenameofan.hbssnippetondisk(startingwithfile:///)
l
thenameofaremote.hbssnippet(startingwithhttp://orhttps://)
Page 778