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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Sightly if else condition for the list in AEM

chandramohanred
Level 1
Level 1

<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
KiranVedantam1992
Correct answer by
Community Advisor
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
KiranVedantam1992
Correct answer by
Community Advisor
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