To create last ten published article news component | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Manu_Mathew_
Manu_Mathew_Accepted solution
New Participant
Jan 31, 2023 1:16 PM UTC

@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.

5 replies

Mohit_KBansal
Employee
Jan 31, 2023 11:50 AM UTC

Have you tried the AEM List core component [1], which provides this capability?

 

[1] https://www.aemcomponents.dev/content/core-components-examples/library/core-content/list.html

Translate
Manu_Mathew_
New Participant
Jan 31, 2023 10:02 AM UTC

@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

 

Translate
Level 2
Jan 31, 2023 12:13 PM UTC

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 

Translate
Manu_Mathew_
Manu_Mathew_Accepted solution
New Participant
Jan 31, 2023 1:16 PM UTC

@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.

Translate