Skip to content

Instantly share code, notes, and snippets.

@fmontes
Created May 1, 2024 16:56
Show Gist options
  • Save fmontes/cd792eb2136888a6b75a6d317acde05c to your computer and use it in GitHub Desktop.
Save fmontes/cd792eb2136888a6b75a6d317acde05c to your computer and use it in GitHub Desktop.
Return JSON from a dotCMS widget
#set($widgetJson={})
#set($conlist=[])
#foreach($con in $dotContentMap.startingUp)
#set($conMap={})
#set($dummy = $conMap.put("title", $con.title))
#set($dummy = $conMap.put("urlTitle", $con.urlTitle))
#set($dummy = $conlist.add($conMap))
#end
#set($dummy = $widgetJson.put("startingUp", $conlist))
$!dotJSON.put("widgetJson", $widgetJson)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment