2

We have a requirement to show on the article page a list of articles which have the same topic and author as the current article i.e. "Related articles". I have two ideas about how that can be implemented:

  • create a custom rendering contents resolver which would pass a whole list of articles existing in Sitecore (it might be around 40) and then it will get filtered according to topic/author on react side. (or maybe it's actually better to filter in the resolver too and only pass the "related" data to react side?)
  • make an api call to backend: create search context and filter the items there & pass the filtered output to the react app

Both seem to be reasonable enough - and it seems like it would be more fun to try the first approach but I'm hesitant because of the large json output for the layout service. What considerations should I take into account to choose between these two options? And... maybe there is a better way I don't know of? Thank you

3 Answers 3

3

From my point of view the right way to do it is to go with a a custom rendering contents resolver.

If the json is too big you can use pagination/filters for it.

On all implementation I saw until now for headless is used custom rendering contents resolver.

0

As per my understanding, you should also have Custom api end points which can be utilized for data orchestration.

It means, whenever you required dependent data you will make a call to Custom API which will internally use layout service and Solr endpoint to return required data in single call with improved performance.

0

I ended up doing a custom rendering contents resolver like Vlad suggested, and also a search context inside it that filters articles right inside the resolver, that way I only get a required amount of related articles data in the react component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.