Reputation: 309
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?
Upvotes: 3
Views: 1301
Reputation: 10780
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'}
Upvotes: 5