DEV Community

Owain Williams
Owain Williams

Posted on • Originally published at owain.codes on

Umbraco "hidden" properties - umbracoUrlName and umbracoUrlAlias

While working on a project I came across an issue where having the ability to give a different url for a page within the CMS would be beneficial.

In the past, I've always just used umbracoUrlAlias but it was suggested that umbracoUrlName might be a better option. This short blog will hopefully bring these properties to light for some of you.

How do you use them?

Both properties can be use on any document type that is accessible via the front end of your site e.g. http://www.owain.codes/about

Add a text string to your document type and make sure that the alias is umbracoUrlAlias or umbracoUrlName.

An example is below for umbracoUrlName

enter image description here

Of course, you can change the Name from umbracoUrlName but make sure the alias, the bit next to the padlock, remains umbracoUrlName.

What's the difference between the two?

I'll use the description that is used within the Umbraco Documentation,

umbracoUrlAlias

This property when created as a text string lets you provide a comma separated list of alternate full URL paths for the node. For example, if your URL was /some-category/some-page/content-node, by adding an umbracoUrlAlias of "flowers", a user can navigate to the node by going to /flowers. The URL alias remains in the browser address bar as a 'mask' over the real URL. You can also specify paths like "flowers/roses/red".

One thing to note is that the original URL is also still accessible. To help understand this, if you think about this property as a url shorterner then it will hopefully make it a bit clearer.

umbracoUrlName

This property when created as a text string lets you provide a different URL name to what is created by default by the name of the node. If you enter a value for this property and save/publish the content node, you will see that its main URL is updated with a new path suffix.

If we use the example that was used above and use the path /some-category/some-page/content-node, if we use umbracoUrlName property and use the word flowersas the value, the url for this page / node is now /flowers.

The longer path name now doesn't exist and the only way to access this node is via /flowers

Other routing options

There are two other options built in to Umbraco that you can use when handling routing.
umbracoRedirect and umbracoRedirectId

In short, umbracoRedirect performs a 302 redirect by using a Content Picker and umbracoRedirectId does a url rewrite.

For more info, check out the Umbraco Documentation

Top comments (0)