Using data-sly-list I can iterate over a list object in Sightly, but how can I check for first
<li>
and add a specific class to it ?
Also, how to display every item separately ? for now my list looks like one LI with all items separated by coma. (<li> item1,item2,item3 </li>
)
<ol data-sly-list="${currentPage.title}">
<li>${properties.title}</li>
</ol>
I did try with:
<div data-sly-test="${!first}">
but didn't worked... any ideas ?
Check the spec, you can use the itemList
variable for this:
<ol data-sly-list="${['a', 'b', 'c']}">
<li class="${itemList.first?'first':''}">${item}</li>
</ol>