Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sightly not recognizing html

Tags:

aem

sightly

I have method which is returning html as a string value. I thought while displaying it will show me string in bold on browser but its showing me the string as is on browser.

public String getHtml() {
        return "<b>kunal</b>";
    }

<sly data-sly-use.item="demo.html.DemoHtml">
    ${item.html}
</sly>

Output:

<b>kunal</b>

Any workaround on this?

like image 925
Kunal_89 Avatar asked Sep 14 '26 23:09

Kunal_89


1 Answers

HTL/Sightly includes XSS protection and will escape your string by default unless you explicitly tell it contains HTML (see https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md#121-display-context):

${item.html @ context='html'}
like image 106
Vlad Avatar answered Sep 21 '26 06:09

Vlad