How to set convenience variables in sightly?

Avatar

Avatar

paro22

Avatar

paro22

paro22

15-10-2015

Hey all,

is there a way to set variables in sightly? Basically I have a lot of variables in my html template and it's getting kind of messy, especially with things like inherited properties [1] and combination of properties for conditions [2]. In a jsp I could just use <c:set> but not here. Any suggestions?

Thanks!

Paul

[1] example for long properties: ${inheritedPageProperties['parBloc1/topbanner/narrow']}

[2] data-sly-test="${inheritedPageProperties['parBloc1/topbanner/narrow'] && inheritedPageProperties['parBloc1/topbanner/test']}"

desktop_exl_promo_600x100_weknowyou.png

View Entire Topic

Avatar

Avatar

gabriel_walt

Employee

Avatar

gabriel_walt

Employee

gabriel_walt
Employee

15-10-2015

I agree with Feike. Keep in mind that each data-sly-unwrap you're doing will represent one step you're moving away from having your template markup to correspond to your resulting markup. The goal of Sightly is to keep the two as close together as possible for making it as obvious as possible for someone who reads the template to understand what the final resulting markup is going to be.