Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

To create last ten published article news component

Avatar

Level 2

How to create a component that populates the last ten published article news components in AEM pages.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@divanshjohndigital If you want to run it at regular intervals you can use sling schedulers and run a cron job. You may also try using event handlers.

View solution in original post

5 Replies

Avatar

Community Advisor

@divanshjohndigital It depends on the use case, probably you can use some published date metadata or use query builder queries for the same.

and use the order by and limit properties-

...
orderby=<somenode>
orderby.sort=desc
p.limit=10 

 

Avatar

Level 2

Hi @Manu_Mathew_ ,

Thanks for ur quick response. Just wanted to check if I use the query builder do i need to run the query each and every time whenever I publish some news article or is there any other way to do this?

 

 

Thanks,

divanshjohndigital 

Avatar

Correct answer by
Community Advisor

@divanshjohndigital If you want to run it at regular intervals you can use sling schedulers and run a cron job. You may also try using event handlers.

Avatar

Community Advisor

So in your case, what you should do is to create a component, and the model written for that component should basically run the query to get the list of pages which are recently published.