Deep duplication of page and blocks



I am trying to find an option to duplicate a page with all the blocks in its content areas aswell as blocks within those blocks etc.

The normal copy/paste creates a new page and only copies the references in the content areas, meaning it's not creating new blocks.

Is there anyway I can duplicate both pages and blocks? Some option I haven't seen or maybe a plugin?

Or do I have to program such an option?

Thank you in advance

Nov 15, 2021 8:02

As blocks work in 2 different modes

  • Local - Appearing in "For this page" in the assets menu
  • Shared - Appearing in "For all sites" in the assets menu

The copy function works different depending on which blocks are being copied.

Any shared blocks are designed to be references and therefore copying any page would just copy the reference. However any Local blocks copy a new instance, I double checked this with the Alloy demo and I can clearly see copying making a new instance of the block when it's local.

So can you explain a little more what you're not seeing that aligns to this and what you're trying to acheive?

Nov 15, 2021 9:45

Hi Scott

Thank you for your insightful reply!

Let me set up the specific customer use case, that lead me to creating this topic:

The customer has a page A with a lot of blocks. These blocks also contains a lot of blocks.

The customer has no idea if these blocks are local or shared.

They now want a page B, that has the same structure as page A. Meaning title, subtitles, containers, image orientation etc, that comes from these blocks.

So they copy page A to create page B. They start changing the images, the text of the blocks on page B only to realize that they are also changing on page A. Which implies they are shared.

They now ask us, can we accomodate their need to copy page an instance of page A with new instances of associated blocks and their associated blocks and so forth and so forth.

Nov 15, 2021 10:18

The customer should very much know the different between what's a shared block and a page block.

It's part of a good content training strategy that customer define local blocks for content that might change on a variation of a page and shared blocks for global reusable blocks. They should also be aware than when going to a page these page specific blocks will appear in the "For this page" area.

The management of blocks and a strategy for local and shared blocks is something key I've always driven in to the clients and provided documentation/training for as fundamentally if you're using the platform wrong then not only will you have issues the customer will have a negative experience of the platform which we should safeguide against.

However if you really want to provide a programmatic solution you can hook in to the IContentEvents serice and put an event handler on the Events_CreatedContent event. From there when pages are being copied you can do whatever you like including converting shared blocks to local blocks if you so desire.

Edited, Nov 15, 2021 11:09