Expand my Community achievements bar.

SOLVED

Sightly if else condition for the list in AEM

Avatar

Level 2

<div class="xyz">
<sly data-sly-list.childPageLvl2="${childPageLvl1.childPages}">
---Iterate and print all child pages---

</sly>
-----View All--- (after child pages are printed then it print 'view all" as a last line)
</div>

 

Hi Team,

As per above code, it print all 'child pages of root page' and then it prints 'View All' at last
if 'child pages are not available for root page' it only prints 'View All' at last.


My requirement is,
It should print 'View All' only if 'child pages of root pages is available'.
it should not print 'View All' at last if child pages are not available for root page. (like if else condition)


Please suggest?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @chandramohanred,

 

Please use the below code:

<sly data-sly-test="${childPageLvl2.size > 0}"> View All </sly>

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @chandramohanred,

 

Please use the below code:

<sly data-sly-test="${childPageLvl2.size > 0}"> View All </sly>

 

Hope this helps.

 

Thanks,

Kiran Vedantam.