Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Can we get related page based on its tags

Avatar

Level 4

Hi Team,

 

Hope you are doing great and thank you for supporting all time.

 

Can we get recent three pages based on its tag on current page through code.

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Community Advisor

@bhagchand thats the power of communities.

 

have you tried to use AEM querybuilder API? you can use something like below to achieve the results. 

 

Note:- please make sure to have indexes created/used.

 

type=cq:Page
tagid=marketing:interest/product
tagid.property=jcr:content/cq:tags
orderby=@jcr:content/cq:lastModified
orderby.sort=desc
p.limit=3

 

Please refer to AEM documenation for further reference:-

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

Avatar

Correct answer by
Community Advisor

Use query builder 

Refer cheatsheet https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md

 

 

Himanshu Jain