In our day to day activity, we use the “Duplicate” key while creating an item from another item. Apart from Duplicate there is another option to clone which Sitecore provides.
Both the functionalities will create a new item but with small differences.
Duplicate
Duplicating an item will create a new item with a desired name in the same content tree location. Sitecore provides two options to duplicate an item.
Select the item and go to the Home tab. Click on the “Duplicate” button and provide a new name to the item.
Right-click on the item and select “Duplicate”.
This will create a brand-new item and the created item has no connection with the parent item. Changes to the parent item will not reflect over here.
Clone
Like duplicate, cloning an item is a one-step process in Sitecore. You have several options to clone an item.
Select the item and go to the Home tab. Click on the arrow of the “Duplicate” button. Over there you will get the option to clone the item.
Select the item and go to the “Configure” tab. There you will get the Clone button.
While you clone the item, you will get a prompt to choose the destination of the cloned item. After choosing the destination, cloning will be done with the exact values of the original item.
Now if you check closely, beside every field, there will be “[original value]”. This means this is the value of the original item.
Now if you change the value in the original item, the corresponding value in the cloned item will be changed. This will propagate to all cloned items in the content tree. Even if you clone from a cloned item, the value change in one place will take place in all subsequent cloned items.
Once the item is cloned, you will get an option to Unclone it, over there in the Home and configure tab.
If you change the version of the original item, the value will not be placed in the cloned item automatically. You will get an option to clone the next version of the original item. And then it will be changed.
If you change the value of any field in the cloned item, you will notice that the text (“[original value]”) besides the field header will be removed and any change in the original item will not take place in the cloned item. Still, in the Configure tab, you will find the item is cloned and you will get an option to un-clone the same.
How to get the cloned items in the Content tree?
While you are opening an item in the content tree you will get to know which item is cloned or not. But there is a way by which you will get to know the cloned item by just expanding the Content tree.
Open the content tree and right-click on the blank space on the left side of the Content tree options. (Shown in the below screenshot)
An option list will come up and from there choose “Cloned Items”.
After this, an icon will be shown beside the item on that blank space.
On clicking the icon, the original item will be selected in the content tree.
It is purely based on the situation when you have to choose Duplicate or Clone. Here are some real-life examples of choosing these two.
- If you have to create another item that will have no connection with the previous one, this will be just another item, choose “Duplicate”.
- Let’s say you are creating page headers and you don’t know what the header text in the site will be, it is not yet decided, you can create one header item and clone the same for other pages. Later, when it is decided, change the text in one and data will be reflected in all the items.