Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello, i have a razor macro which works
@inherits umbraco.MacroEngines.DynamicNodeContext@using umbraco.MacroEngines<ul> @foreach(var page in Model.AncestorOrSelf().Children.Where("umbracoNaviHide!=true")) { <li><a href="@page.Url">@page.Name</a></li> }</ul>
I tested it on umbraco cms.
I created a tree in content Site under content and some page under site.
Site is my homepage and when i'm on this page, my topnavigation display no one link.
Can tell me if i missed some step or juste hepl me ^^
Thank you by advance
Hi Ioic
I don't know razor but viewing the following forum post I wonder if you are missing a directive for the level -e.g.
Model.AncestorOrSelf(1)
http://our.umbraco.org/forum/developers/razor/17829-Razor-Snippet-Top-Navigation-is-Incorrect
As I say I haven't learnt razor yet but the above is different between your code and the code that is detailed in the above post.
Hope this helps.
Nigel
It looks correct (I believe an empty AncestorOrSelf() returns the top node if I'm not mistaken).
Have you tried printing out the Model.AncestorOrSelf().Name and see what you got there?
- Sune
i made a bad architecture.
Thank you for your replies
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Top Navigation doesn't display the link
Hello, i have a razor macro which works
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.MacroEngines
<ul>
@foreach(var page in Model.AncestorOrSelf().Children.Where("umbracoNaviHide!=true"))
{
<li><a href="@page.Url">@page.Name</a></li>
}
</ul>
I tested it on umbraco cms.
I created a tree in content Site under content and some page under site.
Site is my homepage and when i'm on this page, my topnavigation display no one link.
Can tell me if i missed some step or juste hepl me ^^
Thank you by advance
Hi Ioic
I don't know razor but viewing the following forum post I wonder if you are missing a directive for the level -e.g.
Model.AncestorOrSelf(1)
http://our.umbraco.org/forum/developers/razor/17829-Razor-Snippet-Top-Navigation-is-Incorrect
As I say I haven't learnt razor yet but the above is different between your code and the code that is detailed in the above post.
Hope this helps.
Nigel
It looks correct (I believe an empty AncestorOrSelf() returns the top node if I'm not mistaken).
Have you tried printing out the Model.AncestorOrSelf().Name and see what you got there?
- Sune
i made a bad architecture.
Thank you for your replies
is working on a reply...