Content Recommendations Component | Community
Skip to main content
NeelaP
March 7, 2024
Solved

Content Recommendations Component

  • March 7, 2024
  • 2 replies
  • 721 views

Hello Experts, 

I m planning to develop a content recommendations component. My requirement is to customize the existing component so that it populates recommendation article cards using the tags property associated with the page's properties.

Appreciate if I get any guidance on how.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Harwinder-singh

@neelap  I am assuming these recommendation articles are either pages , content fragments , experience fragments.

Inside your recommendation component sling model, you need to get the current page instance and get its page properties/tags , basically anything that you have setup to co-relate the current page to its recommended content.

Then, you pull in these recommendation articles using a JCR query that searches for all content with the relevant tags/properties.

Once, you have all of that, you can then send it to the Frontend to render your recommendation articles list.

2 replies

Harwinder-singh
Community Advisor
Harwinder-singhCommunity AdvisorAccepted solution
Community Advisor
March 7, 2024

@neelap  I am assuming these recommendation articles are either pages , content fragments , experience fragments.

Inside your recommendation component sling model, you need to get the current page instance and get its page properties/tags , basically anything that you have setup to co-relate the current page to its recommended content.

Then, you pull in these recommendation articles using a JCR query that searches for all content with the relevant tags/properties.

Once, you have all of that, you can then send it to the Frontend to render your recommendation articles list.

VatsalGupta
Level 2
March 11, 2024

@neelap  -  Assuming you want to match articles having same tags as the tags on current, in your component model, you can retrieve the tags associated with current page then use that data for JCR query based for your desired content paths in Java code. You should also evaluate if any index need to be created for the query.

Also if the content recommendations need to be updated based on the new articles created, you will also need to keep consideration for caching strategy according to your requirements.