Posts

Showing posts from March, 2022

Customizing LayoutService Pipeline for SXA - Part 2

Image
  In this part, I will cover the implementation with the code.               As mentioned in the previous blog, We have to make changes to   Sitecore.XA.Feature.LayoutServices.Integration   to achieve it. Step 1: Create a new class file for patching with the name   BasicLayoutTransformer.cs Step 2: Copy the existing code from   Sitecore.XA.Feature.LayoutServices.Integration.Transformations.BasicLayoutTransformer Step 3: Modify the   BasicLayoutTransformer   class with the changes we need as per the requirement. Override the TransformElement method with the below code. Step 4: Add a config file that modifies the < transformer   type = " Sitecore.XA.Feature.LayoutServices.Integration.Transformations.BasicLayoutTransformer, Sitecore.XA.Feature.LayoutServices.Integration "   resolve = " true "  /> node with our newly created class and Namespace . ...

Customizing LayoutService Pipeline for SXA - Part 1

Image
Sitecore SXA helps us to develop a site as fast as we can using the OOTB Component and it enables you to model your data in JSON. If you want to build a mobile app and feed it with SXA content, you can edit the JSON content on the page and have output content in JSON instead of HTML. I have faced a scenario that I wanted to blog about it. Existing: By default, SXA gives JSON responses for all the Pages on the site when we add  &sc_device=JSON  to the URL.  Problem: The JSON responses had default parameters like name, path, contents. But we had a requirement where I must return Grid setting, Styles and Variant configured in the Presentation Details. Existing JSON Output: Solution: We have to make changes to Sitecore.XA.Feature.LayoutServices.Integration to achieve it. Step 1: Create a new class file for patching with the name BasicLayoutTransformer.cs Step 2: Copy the existing code from Sitecore.XA.Feature.LayoutServices.Integration.Transformat...