I am hoping someone will be able to help me with this, I have searched the forums and google but I am no closer to figuring it out. I am currently working on a website which includes a list of Biographies for team members.
The structure in the navigation tree looks like this
Home Page Biographies Biography Biography Biography Page Page
Both Biographies and biography have their own document types but my issue with this is when I use "nideInNavi" on the sub node(Biography) it removes the content that must be shown on the Biographies page. I need to hide the Biography node since it looks super messy on the menu.
Is there a way to hide these nodes as default or even target the document type in the navigation using Razor?
This is the razor code I am using up to this point is below
The version of umbraoc I am using is 4.11 and the property is labelled umbracoNaviHide which is working, but it also removes the content from the parent page, which I guess is to be expected.
Hide a document type/subnode of a folder
Hello,
I am hoping someone will be able to help me with this, I have searched the forums and google but I am no closer to figuring it out. I am currently working on a website which includes a list of Biographies for team members.
The structure in the navigation tree looks like this
Home
Page
Biographies
Biography
Biography
Biography
Page
Page
Both Biographies and biography have their own document types but my issue with this is when I use "nideInNavi" on the sub node(Biography) it removes the content that must be shown on the Biographies page. I need to hide the Biography node since it looks super messy on the menu.
Is there a way to hide these nodes as default or even target the document type in the navigation using Razor?
Any help would be greatly appreciated.
Thanks!
:)
Hi Dafydd,
Could you please post your navigation Razor code, then I'm sure we can work it out. Also is your hide property alias called "umbracoNaviHide"?
Thanks,
Jeavon
Hello Jeavon,
Thanks for the reply!
This is the razor code I am using up to this point is below
The version of umbraoc I am using is 4.11 and the property is labelled umbracoNaviHide which is working, but it also removes the content from the parent page, which I guess is to be expected.
@using umbraco.MacroEngines
@inherits DynamicNodeContext
@{
var root = @Model.AncestorOrSelf();
<div class="">
<ul class="nav">
@{ var homeSelected = @Model.Level == 1 ? " class=\"active\"" : string.Empty; }
<[email protected](homeSelected)><a href="@root.Url">@root.Name</a></li>
@foreach (var item in root.Children.Where("Visible"))
{
var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : string.Empty;
var subItems = item.Descendants("Textpage").Where("Visible");
<[email protected](selected)><a href="@item.Url">@item.Name</a></li>
}
</ul>
</div>
}
Thanks!
Ah ok, so what Razor do you use on the parent page to render out the children?
The razor to render the biographies is below and this is placed on the Biographies template
@using umbraco.MacroEngines
@inherits DynamicNodeContext
@{
<ul class="thumbnails list">
@foreach (var item in @Model.Children.Where("Visible"))
{
dynamic image = item.teamMemberImage.First;
<li class="span3 team">
<img src="@image.Crops.cropGalleryThumbnail" alt="@item.teamMemberImage.First.Alt" />
<h2><span>@item.forename</span>@item.surname</h2>
<p class="position">@item.position</p>
<div id="nano-wrap">
<div class="nano-bio has-scrollbar">
<div class="content">
<p>@item.bio</p>
</div>
</div>
</div>
<hr />
</li>
}
</ul>
}
Cool, so just remove the .Where("Visible") so you have @foreach (var item in @Model.Children)
:-)
Thank you so much.
You have just made my friday!!
Have a great weekend!
Excellent! I recognised the postcode on your profile as I grew up in Presteigne many years ago!!!
Have a good weekend also!
What a small world, it is a nice place relax but it can get very quiet which can be boring...
I hope you are doing well in London.
Indeed, incredible and brilliant to see Umbraco has reached Presteigne!
is working on a reply...