Can we get related page based on its tags | Community
Skip to main content
Level 3
May 30, 2022 6:36 AM UTC
Solved

Can we get related page based on its tags

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Himanshu_Jain
Himanshu_JainAccepted solution
New Participant
May 30, 2022 6:55 AM UTC

Use query builder 

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

 

 

Himanshu Jain

3 replies

Himanshu_Jain
Himanshu_JainAccepted solution
New Participant
May 30, 2022 6:55 AM UTC
Himanshu Jain
Shashi_Mulugu
New Participant
May 30, 2022 6:43 AM UTC

@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/querybuilder-api.html?lang=en#search-for-pages-tagged-with-a-certain-tag

Translate
bhagchandAuthor
Level 3
May 30, 2022 6:44 AM UTC

Thanks a lot, let me try with this

Translate