Sightly if else condition for the list in AEM | Community
Skip to main content
chandramohanred
Level 2
April 22, 2021
Solved

Sightly if else condition for the list in AEM

  • April 22, 2021
  • 1 reply
  • 1129 views

<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?

 

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 Kiran_Vedantam

Hi @chandramohanred,

 

Please use the below code:

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

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

1 reply

Kiran_Vedantam
Community Advisor
Kiran_VedantamCommunity AdvisorAccepted solution
Community Advisor
June 1, 2021

Hi @chandramohanred,

 

Please use the below code:

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

 

Hope this helps.

 

Thanks,

Kiran Vedantam.