{{~setVar("fields", [ { name : "social", label : "", value : (function() { if (data.social === undefined) { return undefined; } var socialMap = { "serviceid_4" : { class : "fa fa-facebook-official", service : "Facebook", url : "" }, "serviceid_1" : { class : "fa fa-twitter", service : "Twitter", url : "" }, "serviceid_2" : { class : "fa fa-youtube", service : "Youtube", url : "" }, "serviceid_11" : { class : "fa fa-google-plus-g", service : "Google+", url : "" }, "serviceid_12" : { class : "fa fa-pinterest", service : "Pinterest", url : "" }, "serviceid_13" : { class : "fa fa-instagram", service : "Instagram", url : "" } }; data.social.forEach(function(val) { var item = socialMap[`serviceid_${val.smserviceid}`]; if (item === undefined) { return; } item.url = val.value; }); return Object.values(socialMap).filter(val => val.url.length > 0).map( val => `` ).join(" "); })() } ])}} {{#~var.fields}} {{value}} {{/}}