Thursday, December 22, 2011

Umbraco 5 RC1 is out today

Hi everyone! Have you booked up your Seasonal Religious-or-not Coding Fun calendar yet? No? Well, allow me to proffer a toy for the holidays. We've put up a couple of new Umbraco 5 builds for you to try out. We're calling it Release Candidate 1 - we're almost there in terms of features, and the remaining work for us to get to a 5.0 release is around performance, bugfixes from community testing, and any quick wins around handy methods that help with building a site.

As usual, if you're new to Umbraco 5 or you've come here from a web search, there is some background to the other releases we've done in the previous few months:

- Umbraco 5 Alpha 1 Release

- Umbraco 5 Alpha 2 is out today

- Umbraco 5 Alpha 3 is out today

- Umbraco 5 Beta 1 is out today

You can download the RC 1 web application zip from CodePlex, and within minutes of this blogpost going up our status page will reflect the latest updates too.

Before we crack on, a quick word about timings: while we haven't matched our recent hopes for a Christmas 5.0 completed release, we do know that we will be able to put it out by the end of January. We have now reached the point where we're going to be working on performance and bugfixes in time for 5.0, so that we can then quickly add any popular missing features with future releases (5.1, etc.) We're really grateful for your help testing this release, and we'll be using your feedback to make a lightning-fast, stable 5.0 after Christmas.

What's in the release?

Today's release has two parts. The first has the same level of User support as Beta 1 - i.e., no Members section. The second download is the same fundamental codebase, but with the Members section added. Work on this has not yet been completed, and we're keeping it on a parallel build for the moment so that we can evaluate community feedback and leave the option open for us to release 5.0 either with or without Members support depending on how the testing goes. We'd really appreciate if you could give that one a try too and let us know how you get on.

Issue Tracker

Speaking of "letting us know", it's about time we helped you help the project, by introducing the promised place to log v5 issues. We have used the CodePlex Issues tracker for some time, and it's been very good to us, but there are some niggles - and so we've created a new issue tracker at for people to use for v5 RC1. We'd love feedback on this too, as if all goes well, we could see this as the new central tracker in the future.

We also have some exciting ideas about how to integrate this with the Karma system on Our - if you have any ideas too, please let us know!

The tracker is based on the excellent YouTrack from JetBrains, who have been kind enough to give us a free license for our open-source project.

Registration is open to all. After logging in, you will see the welcome page that gives you a few hints on querying the issues log.


We've got some issues in there already that we'll be working on in time for 5.0:


Logging an issue is really straightforward. You can select a release that you're targeting, and easily include screenshots from your clipboard or filesystem from the "Attach" menu:


Features added since Beta 1

Composite document types

A few people noticed a big feature lacking in Beta 1: inherited document types. Support for this was in the architecture from the beginning, but it didn't make the cut for that release. Today's download has the feature ready and waiting to be tested.

Where it slightly differs from v4.7 is that you can now have multiple parent document types! Party smile You can have two master document types, say "SEO Fields" and "Article Fields", and have a "News Article" document type that inherits the fields of both. We merge any tabs that have the same alias too, so that your editors see fields in common tabs grouped together.

You can change this inheritance structure at any time, but be warned of course that you may end up removing existing properties that you have filled out for content.

Here's an example: I've got a News Article document type which inherits from both "Seo Fields" and "Article Fields". My News Article type has a tab called "Article", and so does the "Article Fields" document type. If I edit "Article Fields", I can see my "Article" tab with its "Body Text" field:


If I edit the child "News Article" document type, I can see the inherited properties greyed-out for reference, and also the "News Title" field that only exists on this document type. I've also got some greyed-out Seo fields there because I'm also inheriting from my handy "Seo Fields" document type.


Editing some content that is a "News Article" shows the two fields merged into one Article tab:



The dictionary is now in there too. You'll notice it in the backoffice under the Settings tree, and you can use the @Umbraco.GetDictionaryItem helper in your templates to insert a value. As I mentioned in the previous release, the Dictionary in v5 uses our revised Language support that allows for fallbacks. So, if you specify that the Belgian French language "falls back" to regular French, any Dictionary items that are blank for Belgian French will revert to the value in the regular French language. This should be a timesaver for scenarios where your usage of the language in your website only differs in a few key words.

A quick word about keys: many have seen that you can have a "hierarchical" dictionary in v4, but you still have to find unque names for your keys, because you refer to them by only their key and not their path in your templates.

This changes in v5. Here's two dictionary items that I have:


Here's the code for using them:

<p>My key:@Umbraco.GetDictionaryItem("MyKey" )</p>
<p>My key 2:@Umbraco.GetDictionaryItem("MyKey/MyKey2" )</p>

Also, since Dictionary items are "just regular content" in Hive, we get Rollback, Move, Copy, and Permissions, all "for free":



You can now click the 'Save' button followed by the 'Preview' button and see your page rendered with the latest revision rather than the published copy.

Hierarchy navigators on DynamicModel

In your templates, you can now use the following navigators:

  • DynamicModel.Ancestors
  • DynamicModel.AncestorsOrSelf
  • DynamicModel.Descendants
  • DynamicModel.DescendantsOrSelf
  • DynamicModel.Children
  • DynamicModel.Parent

Each of these navigators also has more querying and sorting support on there. The following methods are available:

  • Single
  • SingleOrDefault
  • First
  • FirstOrDefault
  • Last
  • LastOrDefault
  • Any
  • Count
  • Where
  • OrderBy
  • OrderByDescending

All of these methods except the last two accept a string for querying against the dynamic properties on a piece of content. You can just supply the string, like v4:

DynamicModel.Children.FirstOrDefault("publisher == \"APRESS\"")

or you can supply parameters in order if you prefer - the numbers just correspond to the order of parameters that you supply after the first part:

DynamicModel.Children.FirstOrDefault("publisher == @0","APRESS")

Normally, if you're used to dealing with lists of objects in .NET (IEnumerable<Something>) you may know that when you access methods like myList.Count(), the Count() method is actually what's called an "extension method" - it's a static method defined in one place that can be used on anything that implements IEnumerable<Something>. Why do we care? Because these static methods don't work on dynamic objects - those where not even Visual Studio knows the properties available, because .NET figures it out when your page is being rendered. But it would be a great pain to have to either not have those handy methods like Count(), Any(), First() on DynamicModel or have to call them in the alternative unintuitive way. So we've added them explicitly to the collection that underpins Ancestors, Children etc.

Long story short, it means you can also do queries like this, using Where() with Count() tacked on the end:

DynamicModel.Descendants.Where("NodeTypeAlias == @0","BookPage").Count()

The OrderBy and OrderByDescending methods take a property alias, e.g. OrderBy("Name")

You can also use the same underscore prefix as in v4.7 in order to put a "recursive" property into your template. This is a throwback to the legacy of XSLT when it was straightforward to say "my current page might not have this property, but please go up the tree until you've found one". A bit like an "inherited" property. Where you would normally write DynamicModel.SiteName to put the Name property from the current page, you can put DynamicModel._siteName with the underscore and lowercasing indicating to the system that, if that property isn't found, it'll go up the tree until it's found it.

Alternative Templates

If you have more than one template available for the document type of your content, you can now include that in the Url similarly to v4. For example, here's the homepage template that I've been using to test querying, it has some cruft at the top:


And here's the cleaner one that I called AltHomepage.cshtml on my filesystem, and added to my Homepage doctype, accessed by adding ?altTemplate=althomepage to my browser address bar:


Happy bug-hunting holidays!

As always, we really appreciate the time people take to test out these releases - even putting up with it not having many performance optimisations until the final stage - and both reporting issues, and collaborating on the community site and on the contrib project.

So, best wishes to you and yours, and see you in the forums!

Team 5

Want to be updated on everything Umbraco?

Sign up for the Umbraco newsletter and get the latest news and special offers send directly to your inbox

Are you sure, that's your real e-mail?