Skip to content

Instantly share code, notes, and snippets.

@ps-team
Created October 27, 2017 09:52
Show Gist options
  • Select an option

  • Save ps-team/f637ba1db3c0d9ca6e99981173f1922b to your computer and use it in GitHub Desktop.

Select an option

Save ps-team/f637ba1db3c0d9ca6e99981173f1922b to your computer and use it in GitHub Desktop.
Contensis Razor Breadcrumb - webAPI only
@using Contensis.Framework.Web;
<ul>
<li>
You are here:
</li>
@breadcrumb(CurrentNode)
@helper breadcrumb(Node node)
{
<!-- node depth,@node.Path == @node.Depth -->
if(node.Depth>0)
{
var parent = node.Parent;
if (node is ContentNode)
{
ContentNode contentNode = (ContentNode) node;
if(contentNode.IsHomePage)
{
parent=parent.Parent;
}
}
@breadcrumb(parent)
}
<li>
@if(node==CurrentNode)
{
@node.Title
}
else
{
<a href="@node.Path">@node.Title</a>
}
</li>
}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment