Expand my Community achievements bar.

SOLVED

fetch all page title & description

Avatar

Level 3

Sling code to fetch all page title & description under /content

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@mamathary999 , you can get hold of the parent content node and iterate over, filter any content if needed and then read page properties (use Page Manager if  the content is just a bunch of AEM pages) ,add each of them to a data structure like a ArrayList or a Map and finally iterate it on the HTL side.

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

@mamathary999 , you can get hold of the parent content node and iterate over, filter any content if needed and then read page properties (use Page Manager if  the content is just a bunch of AEM pages) ,add each of them to a data structure like a ArrayList or a Map and finally iterate it on the HTL side.

 

Avatar

Community Advisor

@mamathary999 ,

This blog explains various ways to iterate over nodes and their performance implications. Please read through: https://kiransg.com/2023/04/18/comparing-stream-based-page-listchildren-and-query-builder-methods-fo...

 

Hope this helps.

 

Thanks,

Sudheer.

Avatar

Level 5

Solutions provided before me perfectly works fine. But the question is what's the intent. Are you trying to build a search component or something like that? Understanding the intent for retrieving all the pages without any filtering criteria. Can you please breif on that. 

Avatar

Level 3

Hi @mahi1729 

 

I am just practicing this use case , I am not aware of filter and all , trying to find the best way to achieve this use case . Can you please help me this which approach would be good