Sightly List first element | Community
Skip to main content
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 kautuk_sahni

Hi

<ul data-sly-list.child="${currentPage.listChildren}">
  <li>${childList.first}</li>
</ul>

Please have a look at this documentation:- 

Link:- http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-1/

// Sample6.html

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/sightly/block-statements.html

//

The following default variables are available within the scope of the list:

item: The current item in the iteration.

itemList: Object holding the following properties:

index: zero-based counter (0..length-1).

count: one-based counter (1..length).

first: true if the current item is the first item.

middle: true if the current item is neither the first nor the last item.

last: true if the current item is the last item.

odd: true if index is odd.

even: true if index is even.

 

Sightly Specification:- https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/master/SPECIFICATION.md#226-list

 

For Looping to the count:-

Loop with fixed number of items

<ul data-sly-list="${ [1,2,3,4] }">
<li>${item}</li>
</ul>

 

I hope this will help you,

Thanks and Regards

Kautuk Sahni

2 replies

edubey
Level 10
June 8, 2016
kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
June 9, 2016

Hi

<ul data-sly-list.child="${currentPage.listChildren}">
  <li>${childList.first}</li>
</ul>

Please have a look at this documentation:- 

Link:- http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-1/

// Sample6.html

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/sightly/block-statements.html

//

The following default variables are available within the scope of the list:

item: The current item in the iteration.

itemList: Object holding the following properties:

index: zero-based counter (0..length-1).

count: one-based counter (1..length).

first: true if the current item is the first item.

middle: true if the current item is neither the first nor the last item.

last: true if the current item is the last item.

odd: true if index is odd.

even: true if index is even.

 

Sightly Specification:- https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/master/SPECIFICATION.md#226-list

 

For Looping to the count:-

Loop with fixed number of items

<ul data-sly-list="${ [1,2,3,4] }">
<li>${item}</li>
</ul>

 

I hope this will help you,

Thanks and Regards

Kautuk Sahni

Kautuk Sahni