Sightly Join with White spaces | Community
Skip to main content
francisco_ribei
New Participant
October 16, 2015
Solved

Sightly Join with White spaces

  • October 16, 2015
  • 2 replies
  • 2093 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by francisco_ribei

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

2 replies

francisco_ribei
francisco_ribeiAuthorAccepted solution
New Participant
October 16, 2015

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

Feike_Visser1
Employee
October 16, 2015

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