Sitecore item copy extensions

It seems to be a good practice and that has been proven on many solutions that we have built.

A very default page structure would look like this:

However, there is one annoying issue related to that. When you copy or duplicate the page, renderings which are assigned to the copied page will remain referring to the data source items of an original page.

In a default scenario of page duplicating, the copied page would look like this:

It adds even more confusion when editor works from within the experience editor as the page looks correct, but when editing, the content changes go to original items and both original and copied page are updated with new content.

Fortunatelly, there is a solution to that. We have implemented a small Sitecore module that solves this issue by re-mapping page-relative data sources to copied ones on item:copied event.

If we visualize what it does – the data source references will be re-mapped from original page to a copied one like this:

Please have a look at my github ItemCopyExtensions

We have also extracted that to a nuget package so all you need to do is to run this command from Nuget Package Manager console:

Install-Package Pintle.ItemCopyExtensions

This will add a dll and a config file to your solution which will handle the problem for you.

Enjoy and spread a word.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s