A different road to Sitecore 8 Upgrade – The final chapter: Presentation!

This post rounds out the series with presentation magic! Following my hypothetical 😉 theme, the next challenge is to somehow translate the presentation from webforms to MVC. Along with moving content, we would also have to set the presentation of these items.

I know that in my hypothetical situation, I have made it a bit more difficult by not only upgrading to Sitecore 8 but also moving from webforms to MVC. Life would be easier if I just stayed with webforms!!! Nope!

I am glad in this situation I decided to go with Sitecore MVC. Was it the right decision, absolutely! Was it easy, absolutely not!

With the final solution it makes it feasible to have an infrastructure which forces re-usability and test-ability. No complaints about that.

Now back to presentation. The first thing you need to do is to keep a tally of the sublayouts to views translations in a spreadsheet. There might be cases where you have consolidate multiple sublayouts into one view or the other way round. You might also have a need for one sublayout to be replaced by multiple views.

In my case, I went with this simple assumption: For a specific kind of presentable item, the standard values presentation on that template should match the functionality in the webforms solution and the MVC solution. Both the standard values presentation (in webforms and MVC) might not match in terms of the number of presentation items but they will match in what they render.

Once that simple rule is set in stone (well for the most part, there will always be exceptions, right?), the rest should be achievable by scripts.

I am not an MVC guru by any means and I feel that in technology its not what you know its how you learn it!. I pride myself in picking up technology as I work, as do a lot of Sitecore folks I know!

For scripting I always use Sitecore PowerShell. I love using PowerShell commandlets and rolling out libraries in solutions to get complicated tasks done and have a repeatable process.

In this scenario we are going to do the following:

  1. Traverse through the current content tree ( you define what to go through, but typically be sitecore\content\home)
    1. For each item we look to see if there is presentation on the standard values, if so we save it
    2. We do a diff of the standard values and the item in questions and store the diff
    3. At the end of this process, we should have an items.xml (diff’ed presentation for each item) and a standardvalues.xml
  2. Take these XML definitions and transfer them to the new site
  3. Build an xml file called presentationdefinitions.xml which has the translation from sublayouts to views
  4. At this point the assumption is that you have set the standard values on the new Sitecore 8 instance, so that template items have base UI
  5. Traverse through the new content tree (this would be the same since we are importing content package from current Sitecore 6.5+)
    1. While traversing the tree which should be the same as the current tree, we reset presentation
    2. Look up the item in the items.xml from the current content site, find the translated presentation
    3. Set the current item with the diff’ed and translated (sublayouts to views) presentation items
  6. Publish and enjoy!

Current PowerShell Commandlet in Sitecore 6.5+
The commandlet which I have in the Sitecore 6.5+ solution shown below. The main purpose is to catalog standard values, use the standard values to get diff’s on item presentation and also keep tabs of unique sublayouts used across the current 6.5+ website.

This commandlet produced the following sample outputs.




Once this is done transfer the items.xml file to a location under the new Sitecore 8.x site. Define the mapping for the old sublayout to the new renderings and store them in PresentationDefinitions.xml


This is just a prototype but you could essentially customize it to your heart’s content. Store parameters, have the ability to push to different place holder than the origin etc.

Once this is done, you will be running the following script on the new Sitecore 8.x site.

There you go, most of the work is done. There will be one off’s which you have to either run a script or manually do them.

If you have any questions or comments please let me know.

no comment

Add your comment

Your email address will not be published.