Sightly - Expression in Expression | Community
Skip to main content
New Participant
October 16, 2015
Solved

Sightly - Expression in Expression

  • October 16, 2015
  • 3 replies
  • 1395 views

Hi all,

I have four images 'abc-820x462-en.jpg', 'abc-590x394-en.jpg', 'abc-820x462-fr.jpg' and 'abc-590x394-fr.jpg' of different dimensions which are to be displayed as per the dimensions selected and also as per the language of the page.

We are able to select the image as per the dimension : 

<img  src="${video.imageSrc || (video.videoSize=='16:9'?'/is/image/content/dam/thdc/common/abc-820x462-en.jpg':'/is/image/content/dam/thdc/common/abc-590x394-en.jpg')}"

            alt="${video.imageMetadata.alt || '' }"/>

Not able to select the image using the language (en/fr)

Can we implement the sightly expression in the above expression again to select the language as well (abc-820x462-en.jpg or abc-820x462-fr.jpg)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

Yes this is possible..

You can save the result into a var with an expression like this: data-sly-test.imageName="${.... }"

Then you can concatenate the language + extension via @ format, see here an example:

http://docs.adobe.com/docs/en/aem/6-1/develop/sightly/expression-language.html

3 replies

smacdonald2008
New Participant
October 21, 2015

For those reading this and wanting to know more about Sightly - see this web presentation: 

https://www.youtube.com/watch?v=QfvFWSQQ_0M

Feike_Visser1
Feike_Visser1Accepted solution
Employee
October 18, 2015

Yes this is possible..

You can save the result into a var with an expression like this: data-sly-test.imageName="${.... }"

Then you can concatenate the language + extension via @ format, see here an example:

http://docs.adobe.com/docs/en/aem/6-1/develop/sightly/expression-language.html

Lokesh_Shivalingaiah
New Participant
October 16, 2015

Its always better to do all this logic in your java class and send the relevant image to your model which will be used to display in your sightly template