2

I am trying to add a New Site Module to the Website, and it is working fine for the first time. But when I try to create a second Module and try to add it, it is giving me error. Please see below the steps, and let me know if what I am doing wrong.

For 1st Site Module, say Top Navigation

  • I added a Site Module in system\settings\Feature\Tenant. I selected Site Module Option in the Wizard. It runs fine.
  • I Cloned a Rendering say Page Content and added that to the Top Navigation Module. For Rendering Parameters & Datasource, I created a copy, and View I used the Original one. It also gets created fine.
  • I went to the Site Node, and from Scripts, I selected Add Site Module Option. In the Wizard, the new Module is coming up, and installed that. For this time, it also gets installed fine.

Now, I created a second Site Module say Left Navigation. I followed the above steps for this one as well.

  • I added a Site Module in system\settings\Feature\Tenant. I selected Site Module Option in the Wizard. It runs fine.
  • I Cloned a Rendering say Page Content and added that to the Left Navigation Module. For Rendering Parameters & Datasource, I created a copy, and View I used the Original one. It also gets created fine.
  • I went to the Site Node, and from Scripts, I selected Add Site Module Option. In the Wizard, the new Module is coming up, and installed that. However this time, it is giving error.

Please see the error below.

ManagedPoolThread #9 08:35:20 INFO  Executing a script in ScriptSession '$scriptSession$|hose22nrougvl4sgzyemmd1l|68b3421b-11fb-4a3e-a3a6-4388bbe85d19'.
ManagedPoolThread #9 08:35:25 ERROR Error while executing NewItem(string path='master:\content\Tenant\Site', string itemTypeName='/sitecore/templates/Branches/Feature/Tenant/Left Navigation/Available Left Navigation Renderings', string newItemValue='')
Exception: Sitecore.Exceptions.DuplicateItemNameException
Message: The item name "Site" is already defined on this level.
Source: Sitecore.Kernel
   at Sitecore.Data.Items.ItemUtil.AssertDuplicateItemName(Item destinationItem, Item sourceItem, String name)
   at Sitecore.Data.Items.ItemUtil.AssertItemName(Item destinationItem, Item sourceItem, String name)
   at Sitecore.Data.Items.Item.Add(String name, BranchId branchId)
   at Spe.Core.Provider.PsSitecoreItemProvider.NewItem(String path, String itemTypeName, Object newItemValue)

ManagedPoolThread #9 08:35:25 ERROR An error occured while processing /sitecore/system/Settings/Feature/Tenant/Left Navigation/Left Navigation Site Setup/Add Available Renderings action
ManagedPoolThread #9 08:35:25 ERROR The item name "Site" is already defined on this level.

I am using Sitecore 9.3 with SXA 9.3. Any leads will be very helpful.

I checked further, and found out that the above works fine on a Single Site Setup. It is giving issue when I have two sites in a Tenant.

3

This is a known issue with SXA. A workaround could be:

  • After cloning rendering and installing the module in the site node, go to Presentation -> Available Renderings. There you'll see, rendering with the name of your website. Rename this rendering with the name of your cloned rendering. Save and publish.

enter image description here

1

For this issue, I connected with Sitecore Support, and they have admitted it as a bug. Please see below their response.

Thank you for contacting Sitecore Support!

During the investigation, I was able to reproduce the issue in my local environment. The behavior you reported was registered as a bug in our bug tracking system. Thank you for reporting the problem.

To track the future status of this bug report, please use reference number 432170. More information about public reference numbers can be found here: https://kb.sitecore.net/articles/853187.

As a workaround for the issue, please try performing the following steps:

Navigate to '/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Scaffolding/Functions/Scaffolding/Rendering/Copy-Rendering' item;
Insert the following lines to script:
...
$availableRenderingsAction."Location" = "{84179507-91A2-47EA-A424-9D338F64C953}"
$availableRenderingsAction.Editing.BeginEdit();
$availableRenderingsAction."__Name" = $model.TargetModule."Name";
$availableRenderingsAction.Editing.EndEdit();
$TemplatesFolderForFeature = Get-BranchesFolderForFeature $model.TargetModule
...

These lines will assign 'Name' field value of 'Add Available Renderings' item during Rendering Cloning.
Alternatively, you could set 'AllowDuplicateItemNamesOnSameLevel' setting to "true" in Sitecore.config file.
1
  • I am running into the same issue. Is there any specific line number after which I should insert those line in the script for Copy-Rendering? Also this will work for the new renderings that we will clone , but for the already existing ones I will have to rename them manually or set the AllowDuplicateItemNamesOnSameLevel to true. – Renuka May 10 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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