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.