Skip to main content
Community Advisor
Oct 16, 2015 2:28 AM UTC
Solved

Unable to get properties in inline style background:url in sightly

I am not able to get ${properties.imgUrl2} in the following html tag

<div style="background:url('${properties.imgUrl2}') no-repeat; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover;" class="row-item">

If I print this ${properties.imgUrl2}  outside the background-url and div tag I can see this value on the html page

This style is displayed in browser as

<div style="background:url('') no-repeat; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover;" class="row-item">

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
boser87Accepted solution
Level 4
Oct 16, 2015 2:28 AM UTC
        Hello, The Code you try to Output is filtered out by Sightly xss fulters. But you can skip that control in cases like yours. Use context Sightly option. Take a look at this http://docs.adobe.com/docs/en/aem/6-0/develop/sightly/expression-language.html#Display Context

2 replies

boser87Accepted solution
Level 4
Oct 16, 2015 2:28 AM UTC
        Hello, The Code you try to Output is filtered out by Sightly xss fulters. But you can skip that control in cases like yours. Use context Sightly option. Take a look at this http://docs.adobe.com/docs/en/aem/6-0/develop/sightly/expression-language.html#Display Context
Translate
krish1442
Level 2
Nov 11, 2016 2:51 PM UTC

Just to be specific

By adding @ context='uri' here solves the problem....

<div style="background:url(${properties.imgUrl2 @ context='uri' }) no-repeat; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover;" class="row-item">

Translate