Posts

Sitecore CLI Serialization - Installation and troubleshooting

Image
CLI was one of the topics for Ideas for Hackathon 2022. That was the first day when I was trying to install CLI. I was having a few issues when installing it so gave up. After several tries, I finally installed it. CLI - Sitecore Command Line Interface (CLI) allows console communication with a Sitecore instance. You can install Sitecore CLI either as a local tool for individual projects or as a global tool for all projects. Let’s see how to install Sitecore CLI in your project, You must have  .NET Core  installed on your workstation before installing the Sitecore CLI. To install Sitecore CLI as a local project tool: 1.      If you have not already done so,  install Sitecore Management Services . 2.      Open a terminal with administrator privileges. 3.      Run the following commands to install Sitecore CLI. cd <project folder> dotnet new tool-manifest dotnet nuget add source -n Sitecore https://sit...

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

Alternate URLs Using Aliases In Sitecore

Image
Sitecore determines the default URL for an item based on its path, for instance the default URL for /sitecore/content/home/career/path/jobs is [sitename] /career/path/jobs . In some cases, it is useful to have shorter URLs that map to longer paths, for instance,[sitename]/jobs may be preferable as alternate URLs through a feature known as Aliases . To create an alias i n the Content Editor:  1. Go to Content Editor, click on the Page,  On the  Presentation   tab, in the   URL   group, click   Aliases . 2.  In the  Aliases  dialog box, in the  Name  field, enter the alias name. 3.  Click  Add. 4. W hen you have finished defining the aliases you want, click  OK . To create an alias i n the Experience Editor:  1. Click on the Page, Goto to Experience Editor ,  On the  Presentation   tab, in the   URL   group, click   Aliases . 2.  In the  Aliases  dialog box, in the...

ZERO DOWNTIME - SOLR SWITCH INDEX REBUILD

Image
We always have to worry about downtime or slowness in the website when the index is triggered. Our website search might stop or a few functionalities will be missing. You can set up Solr to rebuild an index in a separate core so that the rebuilding does not affect the search index that is currently used. Once the index’s rebuilding and optimization are completed, Sitecore switches the two cores to get the expected output. The SwitchOnRebuildSolrSearchIndex class inherits from the SolrSearchIndex class and adds the capability of maintaining two cores for a particular index. Sitecore switches the primary and secondary cores by sending a  SWAP  request to Solr. Please follow the below steps: Let’s have “sitecore_web_index” as the Primary core . Copy the “sitecore_web_index” in C:\solrx\server\cores_data and create a Secondary core named “sitecore_web_index_rebuild”. Similarly copy the “sitecore_web_index” folder in C:\solrx\server\solr and create another fol...