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:


Comments

Popular posts from this blog

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco - Reset the Admin Password via SQL Server

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version