The Sitecore item cloning is a technique in which you can create a copy of an item that inherits the field values of the original items.
In the latest versions of Sitecore (at least from 9.0 and forward) you can ask if an item is a clone:
Database master = Database.GetDatabase("master"); Item item = master.GetItem(someGuid); bool isClone = item.IsItemClone;
But please notice that the Item.IsItemClone will always return FALSE if you request the item from the WEB database:
Database web = Database.GetDatabase("web"); Item item = web.GetItem(someGuid); // This value is always false bool isClone = item.IsItemClone;
This is because the Source and __Source Item fields of an item are the fields on the original item that tells Sitecore that this item is cloned:
… is not copied to the WEB database when published:
This is by design. If you would like to know if an item is a clone (to avoid duplicate items in your sitemap, of when creating canonical URL’s, for example), you will need to code a solution yourself.
MORE TO READ:
- Sitecore Clones from Sitecore documentation
- Clone and Unclone an Item from Sitecore documentation
- Sitecore item.IsClone vs item.IsItemClone from StackOverflow