Sitecore 9 placeholder upgrade

Dynamic placeholders are unique keys that are guaranteed across different renderings and we can generate the functionality which will generate multiple placeholders within the same rendering.

In the previous versions of site core, if we have dynamic placeholders and the content authors use experience editor to add components in dynamic placeholders, Site core 9 upgrade will result in changing the ids of placeholders of page which are using Experience editor changes.

Old Dynamic Placeholder Pattern

content_{6CEBD6BD-2CB5-4F56-B50F-B82D8D84C8D2}

New Dynamic Placeholder pattern – Format of placeholder is ({placeholder key}-{rendering unique suffix}-{unique suffix within rendering})

Content-{6CEBD6BD-2CB5-4F56-B50F-B82D8D84C8D2}-0

So I came across several blogs and found that the site core dynamic placeholder pattern has been changed to the following format

{placeholder key}-{rendering unique suffix}-{unique suffix within rendering}

There are two options I found and they are

  1. Run PowerShell script available at https://www.sitecorenutsbolts.net/2017/10/17/Sitecore-9-Upgrading-to-Dynamic-Placeholders/
  2. Build a utility or page which will change the placeholder keys of all the renderings of sitecore page which are using dynamic placeholder.

For some reason, PowerShell script was not an option for me so I have created a page to accommodate this.

I have created a page script which replaces the placeholders from old dynamic placeholder pattern to new dynamic placeholder pattern

I have published the page at https://github.com/ramakrishnaila/DynamicPlaceholders

Since we are using site core API to retrieve all the pages from site core, site core have default limitation of number of items it retrieves from database. There is setting which will dictate site core the number of items it retrieves from the database. This is available at C:\inetpub\wwwroot\local.sitename\App_Config\Sitecore.config and name of the setting is Query.MaxItems.Default sitecore installation setting is 100.  Before running the script make sure to change the value of the setting to a number which is more than the number of pages on your site. For Example,

<setting name="Query.MaxItems" value="5000" />

Once the page is executed, we will have all the placeholders which adopts the new site core placeholder pattern.

The result of the page should provide the information of number of pages it processed the placeholder upgrade.

It should show similar information like the following.

Below is the list of pages which are affected with this change from site core upgrade

287 Items processed

/sitecore/content/Sites/horizontal/Home