Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Sightly Join with White spaces

Avatar

Level 6

Hi,

I need to join a string array with whitespaces. 

I'm doing that this way:

${item.tagNames @ join=' '}

But when it is printing it this way in the HTML:

tuna sushitypes

Is there any way to do that?

Thaks

1 Accepted Solution

Avatar

Correct answer by
Level 6

I found a way:

1. Store it using data-sly-test

<div data-sly-test.joined="${item.tagNames @ join=' '}" data-sly-unwrap />

2. Use the context='unsafe'

${joined @context='unsafe'}

Thanks

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

I found a way:

1. Store it using data-sly-test

<div data-sly-test.joined="${item.tagNames @ join=' '}" data-sly-unwrap />

2. Use the context='unsafe'

${joined @context='unsafe'}

Thanks

Avatar

Employee

You can also combine options, like @ join=' ', content = 'HTML'

Try to avoid the 'unsafe' context, the first output you had was correct, because the space was escaped for XSS.

In this doc-link you can find more @ context options: http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html