I've created an About Us page - underneath it I've created some child pages:
This is how it looks:
This is the razor I use:
@if (CurrentPage.Children.Where("Visible").Any())
{
<ul>
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
@foreach (var childPage in CurrentPage.Children.Where("Visible"))
{
<li>
<a href="@childPage.Url">@childPage.Name</a>
</li>
}
</ul>
}
But the problem is, when I click on the child pages, for example the "our area of work" - its pages navigation is not there anymore.
And know that, because the child page, doesn't have any child pages.
But can someone help me out with this? I need it to be fixed!
Dependig on your content structure, this should do the trick for you. Perhaps you need to change the AncestorOrSelf(2).
@if (CurrentPage.AncestorOrSelf(2).Children.Where("Visible").Any())
{
<ul>
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
@foreach (var childPage in CurrentPage.AncestorOrSelf(2Children.Where("Visible"))
{
<li>
<a href="@childPage.Url">@childPage.Name</a>
</li>
}
</ul>
}
Problem with child pages (navigation)
Hey guys!
I've created an About Us page - underneath it I've created some child pages:
This is how it looks:
This is the razor I use:
}
But the problem is, when I click on the child pages, for example the "our area of work" - its pages navigation is not there anymore.
And know that, because the child page, doesn't have any child pages.
But can someone help me out with this? I need it to be fixed!
Thanks in advance!
Hi Sharmarke,
Dependig on your content structure, this should do the trick for you. Perhaps you need to change the AncestorOrSelf(2).
Hope this can help you in the right direction.
/Dennis
Thanks Dennis!
It's working now.
is working on a reply...