You can fix the navigation menu in two ways:
Dynamically - Umbraco creates a navigation menu from the pages in the Content Tree, so when you create a page it automatically appears in the navigation menu. Using dynamic navigation, you do not need to manually add or change your menu items if the page changes.
Hardcode it - You can hardcode the navigation menu but they would require more upkeep in the future if you want to remove a page or change its name.
To create dynamic navigation links from published content nodes, follow these steps:
Go to Settings.
Select Templates from the Templating section, and open the Master template.
Locate the <!-- Navigation -->
tag (around line 22).
Right below it, place the cursor on an empty line.
Select Query builder... in the top-right side of the editor.
Make sure it is set to say "I want all content from my website".
Click Submit.
You now have the following snippet in your Master Template:
This snippet will now need to be merged with the navigation above it.
The <ul>
tag needs to be wrapped inside the <div class="container">
and <nav>
tags, and the classes need to be added to the correct tags as well.
The final result will look like this:
The final step is to Save the Master template.
To add a basic hardcoded navigation, follow these steps:
Go to Settings.
Select Templates from the Templating section, and open the Master template.
Go to the <!-- Navigation -->
tag (around line 22), copy the content within the
tags (around line 23 to 45) and replace it with the following code:
Click Save.
The IsVisible() helper method
If you add a checkbox property to a Document Type with an alias of umbracoNaviHide, the IsVisible() helper method can be used to exclude these from being shown in any collection.
Let's test the menu. You'll find that clicking on the Articles link throws an Umbraco error as we've not created this page yet. We'll create the Articles page in the next chapter.