Codegarden 08: Hidden gems
Published on 05. June 2008 inThis is just an ultra short writeup of some of the hidden gems presented at one of the Open Space sessions at codegarden.
You can now get the image source directly in the template: <img src='<umbraco:Item field="umbracoFile" nodeid="1072" runat="server"></umbraco:Item>' /> 'nodeid' is the id of the media item.
"Magic" document property names
These all work by adding a property to your document type with the mentioned name as property alias
umbracoRedirect When a nodeid is entered in this property on a page, Umbraco will redirect to that page.
umbracoUrlName If you want to change/override the niceUrl of a page, but don't want to change the pagename property, this is the way to go.
umbracoUrlAlias This will _add_ new url's that will show the page. For example if you have a page hidden deep in your nodetree, you can add "signup" to the property, and you can now access the page on "/signup.aspx" (or without the .aspx if you are using directory url's). You can add multiple shortcuts by separating with a comma (no spaces): "signup,membership,deeper/url/here".
Feel free to add more of the gems from the session (I didn't attend the whole thing)
Related posts
Comments
Comments disabled
Comments are disabled for this post.

On 06. June 2008 by Søren Linaa
Great post Morten.
And great news that it's finally posible to insert a image in a templates, but how do I insert this picture if I'm using the mediapicker. I'm sure it's not intended that the nodeId has to be manually updated.
On 06. June 2008 by Morten Bock
Good question Søren. I'm guessing that you could set nodeid="myMediaPickerProperty″ but I have not tried it. Will test it later, but keep me posted if you figure it out first :-)
On 07. June 2008 by Søren Sprogø
Oh wauw, nice one's!
Are these gems for v3.x or 4.x?
On 07. June 2008 by Morten Bock
The “Magic” document property names work in all v3 versions I think. And maybe also in v2.
According to Casey, the file source trick might also work in the latest v3.x releases, but they are quite heavy on performance in the 3.0.x series.
On 12. June 2008 by Casey Neehouse
Not all the Magic properties work in v3 or v2. umbracoRedirect and umbracoUrlAlias are pre-existing entities.
umbracoInternalRedirect (not sure if this is the exact name) will also be part of v4, though we did not find it during the session. It will handle transparent transfers. Great for pointing a root node to a homepage node.
Also, the property on the Item tag for nodeId is case sensitive.
I will have a complete writeup of the session in the near future, as well as other features that were not discussed.
On 14. June 2008 by Casey Neehouse
The internal redirect name is "umbracoInternalRedirectId". It dynamically reloads the content that is going to be displayed transparently. Thus, no url change.
Case
On 18. June 2008 by Ismail Mayat
Morten,
Nice one, I missed this session and have just made use of umbracoUrlAlias
On 17. June 2009 by Sean Rock
under umbracoUrlAlias, you mention...'if you are using directory urls'. What do you mean by directory url?
On 17. June 2009 by Morten Bock
Hi Sean
In the web.config you can setup umbraco to use directory url's, like /home/subpage instead of /home/subpage.aspx. Be aware that you also need to enable wildcard mapping in your IIS for this to work.