Blocks under 'For this page' missing after copying the page.

Vote:
 

We have a slightly odd problem on one of the solutions we look after running 11.20.16

After the client copys a page the blocks copied from the original 'For this page' folder cannot be found in the Assets pane. We are able to see that the have copied, and they're in the content areas on the copied page and can be edited from there. We can also confirm they are copies as we can see the IDs have changed from the original page and they have their own version history starting from the copy - but they do not show in the 'For this page' folder on the newly copied page.

Has anyone encountered this behaviour before or have any advice on identifying the issue and resolving it?

The problem was noticed as the client was wanting to copy an existing page to use a template for a new page they were working on, then after they did this they were looking to copy one of the blocks - but without it showing in the asset panel there is no easy way for an editor to copy the block.

#291054
Nov 03, 2022 13:46
Vote:
 

Ive had this issue occur to me previously and the quick fix was to goto Website Settings in Admin mode, de-select site specific assets save then re-enable and save. It's not a long term solution but worth a try 

#291105
Nov 04, 2022 18:13
Vote:
 

Just coming back on this as we did eventually identify the cause of the issue. Not sure we fully understand it but we have a fix that resolves it for our needs.

The cause seemed to be related to calling GetOrCreateAssetFolder on the ContentAssetHelper in the OnPageCreated(ContentEventArgs e) event of a page. In one of our sites there was certain logic to create blocks and automatically add them to the page during page creation. On copying the page this seemingly caused it to get given a new asset folder, leaving the old one orphaned somewhere but with the block in the orphaned asset folder still on the page.

The current fix, as we cannot just remove the existing logic at the moment is as below.

        public override void OnPageCreated(ContentEventArgs e)
        {
            base.OnPageCreated(e);

            if (e is SaveContentEventArgs se && se.MaskedAction == SaveAction.CheckOut)
                return;

            //-- rest of code here -- //
         }
#299209
Mar 29, 2023 14:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.