2022.2

Table Of Contents
1. Openthesectioninwhichthesnippetisused.
2. SwitchtoSourceview.
3. Lookforthe<article>elementintheHTMLandreplacetheoldsnippetnamewiththenewname
inthesourceattribute.
Translatingasnippet
Snippetsinamultilingualtemplategettranslatedatthemomenttheyareinsertedintheoutput,ifthe
textistaggedfortranslation.Formoreinformationsee"Translatingtemplates"onpage856and"Tag-
gingtextinsnippets"onpage859.
JSON snippets
JSONsnippetsaresnippetsthatcontainJSON datainsteadoftext.Justlikeothertypesofsnippets,
JSONsnippetsarestoredintheSnippetsfolderontheResourcespane,buttheirfilenameendsin
.json.
ThistopiccontainsinformationthatonlyappliestoJSONsnippets.Ifyouwanttoknowhowtoaddan
existing(remote)snippettotheresources,orhowtocreateanemptyJSONsnippet,pleasesee"Snip-
pets"onpage661.
Tip: ItispossibletoopenandeditanyexternalJSONfileintheDesigner:selectFile > Open,
selectAll files (*.*)asthefiletypeandthenselectanHTMLorJSONfile.
UsingaJSONsnippet
UnlikeHTMLsnippets,JSONSnippetscannotbeinsertedintothecontentdirectly,buttheycanbe
accessedviaascriptusingtheloadjson()function.
ToloadaJSONsnippetinscript,use:loadjson(‘snippets/nameofthesnippet.json’).
Forexample:
var json_data = loadjson("snippets/snippet.json");
results.html(json_data.field1);
Seealso:"Writingyourownscripts"onpage808and"loadjson()"onpage1184.
ForanexampleinwhichJSONsnippetsarebeingusedtolocalizeatemplate,seethishow-to:Local-
izingtemplatesusingjson.
Handlebars templates
InOLConnect,Handlebarstemplatesareaspecialkindofsnippets.Justlikeothertypesofsnippets
(see"Snippets"onpage661),HandlebarstemplatesarestoredintheSnippetsfolderonthe
Resourcespane,buttheirfilenameendsin.hbs.
Page 665