Skip to the content

How To add a Link To a Doc Type in Umbraco 8

In This Blog article for Umbraco 8 Novice to Expert I will Show you how to add a link to a previously Created Doc Type and Template

Step 1. As always login to the back-office of your Umbraco 8 website.

Step 2. Navigate to the Doc Type you wish to add your link to Settings>Document Types>Your Chosen Document.

Step 3. Next Click Add Property and give your Property a Name and Description and choose your editor. For linking to a page inside your site you want to choose the "content picker" Editor (Be sure to take note of your property alias).Click Save And Then Save and Publish.

Step 4. Now you Need to populate your new property with content in this case this will mean telling the link where it will need to point to. To do this you will need to navigate to Content>The page you added your new property to. And then fill in the field for your newly created Property.

Step 5. Once your link knows where it is pointing you need to add some code into the page template for your link to actually show up on your page. Start by opening up Visual studios and navigating through the files to the views for you chosen page (YourWebsiteFileName>Views>YourPage.cshtml).

Now you should be able to see the code for the template you want to edit.  

Step 6. Now you need to add the code calling your new property to add it to the page. First choose where you want your link to be displayed and set your cursor to type where you have chosen.

Step 7. Now To make things easier Copy this code into your template. Just Change where i have typed YourAlias to your actual alias you got when creating the property.

@if (Model.YourAlias != null)
<a class="button button--border--solid" href="@Model.YourAlias.Url">

*/Just remember when rendering link just check if it exists Before attempting to display the link./*

In other words check make sure the link is not NULL before attempting to add it the website.

Step 8. Now you want to save your file in Visual Studios and Stop Debugging, Then Start Debugging again and See if your link has been added to your site. If you have followed every step correctly you will not have any issues.


About the author

Nathan Reece

.Net MVC Developer | Umbraco Novice

Hey Guys,

I'm an New Developer with a passion for coding. I absolutely love working with Umbraco CMS and appreciate the Umbraco community even more.

I've got 3 years+ .Net experience and 5 years+ experience working in the Web Develepment industry, both coding and marketing job websites. I wanted to use my skills to help give something back to this awesome community and seems like the right place to do just that.

Follow me on social media

If you're an Umbraco professional, partner, employer, recruiter or a passionate Umbraco community builder then I'm more than happy to hear from you. Follow me on my social media channels and please reach out if you have any needs, want help or consultation with anything Umbraco related or just want a general chat.

comments powered by Disqus

Blog Filter

How we can help?

Need help with an Umbraco project?

Need help with a project but not too sure who to approach? Send us your project brief and budget. We will provide a free consultation and can help you gather quotes from the best and most suitable freelancers or agencies.

Looking to hire an Umbraco Professional?

Have you got job vacancy and want to hire an Umbraco professional? Post a job on our website for free. Alternatively let us know your requirements and we will send suitable prospects your way.

Claim your free profile!

Are you an Umbraco Freelance Developer or Umbraco partner that wants to advertise on our site? If you work with Umbraco or registered as an Umbraco partner then you can create a profile for free.

Let's build the Umbraco Community

We're big on building the Umbraco community and we think you guys are awesome! If there's anyway at all we can help then please reach out.