Expand my Community achievements bar.

SOLVED

Content Recommendations Component

Avatar

Level 1

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 3

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