One approach could be to create a custom view page with a flag for showing/excluding the tree menu.
public class CustomViewPage<T> : WebViewPage
{
public bool ShowTreeMenu
{
get
{
return (ViewBag.ExcludeMenu == null || ViewBag.ExcludeMenu == false);
}
}
}
Inherit the custom class from within the layout file:
@inherits CustomViewPage<dynamic>
Then (In the layout file) only display the tree menu if:
<nav>
@if (ShowTreeMenu)
{
@Html.Partial("_TreeMenu")
}
</nav>
And set the flag from the content page when the menu should be excluded:
@{
ViewBag.Title = "Home Page";
ViewBag.ExcludeMenu = true;
}