Umbraco 7 Hide a page from Navigation or Sub Navigation with umbracoNaviHide using Razor in a template or partial view

How to Allow the user to Hide a Page from Navigation in Umbraco 7. By using a tick box:

This example shows hide the Search Results page from the main navigation in umbraco 7.

1)  In your Document Type add a property called "umbracoNaviHide", it must be called "umbracoNaviHide"

The property should be a tick box, so it should be a "True/False "

2) In your Navigation, add the highlighted code to your for each loop that writes out the navigation:

  @foreach(var p in homePage.Children().Where("visible"))
                            write out navigation

3) Now when the user ticks Hide from Nav in the backend, the page will not show in the navigation:


Popular posts from this blog

Umbraco 7 - C# Razor - Passing a parameter variable from a Template to a Partial View.

Umbraco Razor Sort Nodes Ascending or Descending