Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

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

Avatar

Level 9

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">

1 Accepted Solution

Avatar

Correct answer by
Level 4
        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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4
        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

Avatar

Level 2

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">