1

Could someone explain the difference between Content Resolver and Item Resolver?

I see for Content Resolver, we create the resolver item in sitecore modules whereas for Item Resolver, we add it in patch file.

I feel both does the same job. Please clarify.

2 Answers 2

1

In a layman term,

Item Resolver: Sitecore checks the requested URL and decide which Sitecore Item from Sitecore content tree need to server to the client.

Content Resolver: Content Resolver has business logic to generate content (JSON for layout service) for the rendering/component.

1
  • 1
    Thanks @Jitendra. I prefer layman terms for easy understanding.
    – user11894
    Commented Jul 13, 2022 at 18:28
2

From the understanding point of view, you use contents resolvers with the Sitecore Layout Service to provide more complex data beyond the serialization of a component data source. The Layout Service composes and serves a JSON description of the context, route, placeholders, renderings (components), and datasources that can be used to populate the data which the rendering engine uses to render the final UI of the application.

The content resolvers are a built-in mechanism that allows you to configure a rendering in a way that the data returned matches the configuration.

Out of the box, Sitecore Headless Services provides 6 resolvers, and these are in sitecore/System/Modules/Layout Service/Rendering Contents Resolvers

To know how to use the content resolvers, you can follow this blog.

https://andypaz.com/2020/10/14/sitecore-layout-service-and-rendering-contents-resolvers/

On the other hand, the ItemResolver processor is responsible for getting the Sitecore context item by the incoming URL. If you have a URL that doesn't match with the Sitecore content tree path then you need to create a Custom Item Resolver that will be inherited from the HTTPRequestProcessor and add it to the patch file. Here is the blog that I have written, what was my needs and how I created that.

https://sbhatiablogs.wordpress.com/2020/10/01/sitecore-commerce-custom-link-provider-and-item-resolver/

And more information on item resolver.

https://doc.sitecore.com/xp/en/developers/82/sitecore-commerce/create-friendly-urls-for-catalog-items.html

2
  • Thanks @Sumit Bhatia
    – user11894
    Commented Jul 13, 2022 at 18:27
  • @user11894 Please approve the answer if you think it fulfills your context. Thanks Commented Jul 14, 2022 at 4:06

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.