Menu

Sitecore development company

How to clone a rendering in Sitecore SXA?

In Sitecore Experience Accelerator (SXA), cloning a rendering is not a common practice. The approach in SXA is to create Rendering Variants. However, if you find a need to clone a rendering, you can follow these steps:

  1. Open the Content Editor.
  2. Navigate to the rendering you want to clone. The path is usually `/sitecore/layout/Renderings/Feature/Experience Accelerator`. The rendering could be in any folder within this, based on the module it belongs to.
  3. Once you’ve found the rendering you want to clone, right-click on it and select `Clone`. Alternatively, from the Home tab in the Content Editor ribbon, in the Operations section, click `Clone`.
  4. Sitecore will ask you to provide a name for the clone and where you want to place it. Remember that this will be a new item, so you should provide a new name to avoid confusion.
  5. After you provide the name and location, Sitecore will create the clone. This will include a new `.cshtml` file, which will be placed in the same location as the original `.cshtml` file but with a new name matching your clone’s name.
  6. You can now modify the cloned rendering according to your needs.

Remember, this method creates a copy of the original rendering. Any changes you make to the original rendering will not be reflected in the cloned rendering, and vice versa. This is different from creating a Rendering Variant in SXA, where changes to the original rendering would be reflected in all variants.

Always remember to thoroughly test any new renderings or rendering variants in a safe environment before deploying them to a live website.