Nested Content in the Umbraco Core
Learn how Umbraco have brought the very popular plugin, Nested Content, into the Umbraco Core code and what that means for your existing projects using Nested Content.
I've been using Nested Content by Lee Kelleher for over two years now. I love it and most importantly so do my editors as it gives them lots of flexibility in their page layouts without me (as a web developer) worrying about layouts breaking on different devices and screens.
There are other similar packages out there like the excellent Archetype (which has now been sunset) but I always preferred Nested Content for the very reason the Umbraco team must do in that it uses standard Umbraco functionality of DocTypes. This means the package is simpler and in my book, simpler means less code and less bugs and we get to use a UI we're familiar with and all the standard DataTypes we like.
By using doc types, we get the benefit of an easy / reusable UI we are all familiar with and also get to re-use all the standard data types as our field editors rather than being limited to a subset of “allowed” types."Nested Content Developer, Lee Kelleher
So, now it's in the Core from Umbraco v7.7, what happens if you've already been using it and want to upgrade Umbraco?
The good news is, you don't have to do anything, the upgrade won't affect your existing Nested Content implementation so if you wish you can carry on using it as you are. But if you're like me, you'll want to tidy things up - there's no point having a NuGet package installed if you don't need to.
After upgrading Umbraco, you'll see there is still a DataType Property Editor called "Nested Content" but there is also another called "(Obsolete) Nested Content" - guess which one is yours :)
However, if you try to switch to the new core Nested Content DataType then all your settings disappear! And with it your content! Wow, not a mistake you want to make on a live web site!
Install the Umbraco package uMigrate for a flexible and powerful approach to pushing your CMS database changes through your environments to Production.
uMigrate Your DataType
So, I found the best approach is to "uMigrate" your DataType to use the new Umbraco DataType editor. If you're not using the excellent uMigrate package I highly recommend it as it provides a great way to do Code-First Umbraco changes which if you run multiple environments is pretty critical to successful development.
We'll assume you use or have now installed uMigrate. All you need to do is run a one-line migration and you'll be using the new Umbraco core DataType (don't forget to change the DataType name to match yours):
DataTypes.Where(x => x.Name == "My DataType Name").SetEditorAlias("Umbraco.NestedContent");
For a full example of the migration see the Related Downloads section below.
Finally, after running the migration you can now uninstall the "Our.Umbraco.NestedContent" NuGet Package. This will remove the obsolete data type from the list and everything will be nice and tidy now.
We like nice and tidy.