Umbraco: Retrieving common page URLsAdd to My Brief

Matthew Boniface | 16/12/2011

On a current Umbraco CMS website project I found the need to create an effective method for looking up commonly used important pages without requiring their Umbraco PageIDs.

I wanted the ability to, from anywhere, easily call for the URL for pages like “Home”, “Login” or “My Profile”. After exploring various options I settled on what I believe is a tidy way to tackle this challenge.

I created an enum for the Umbraco “Document Types” that we want to reference:

These need to match exactly to their respective Document Type’s Alias that you specified in Umbraco settings.

That’s the easy part, now needed a way to look up that document type. Turns out that’s pretty easy with Umbraco’s 

 

Now the final touch to retrieve that node's URL:

It is now very trivial to get, for example, the forgotten password page URL from anywhere by just calling:

tags: Web Development

Interested in learning more?

Wiliam is a leading supplier of web solutions and can provide expert advice to assist your business or organisation online.

Make enquiry   Request quotation

Comments

Share this page

Print this page Email this page to a friend Bookmark and Share

No Brief added yet.

My Brief results-driven approach emphasises a commitment to our clients needs through strategic analysis and best-practice.

Add to My Brief

Click on this icon to save item into My Brief. Retrieve, email and print

Drag & Drop

Drag & drop any iten with this icon into My Brief. Retrieve, email and print

Search Blogs