The above obviously displays the site naviation front end when assigned to a macro and added to a template. That is fine. However, if I wanted to show the same output from this Razor script in the Umbraco back office on a node / document type as a way of previewing to the Nav to the user, what would be the correct / best process to achieve this in order that they would see the same output as the front end when they are on that node in the CMS?
Showing output from .cshtml in the Umbraco back office on a document type.
I have a simple .cshtml file as per the default Navigation template in Umbraco.
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
@*Get the root of the website *@
var root = Model.AncestorOrSelf(1);
}
<ul>
@foreach (var page in root.Children.Where("Visible"))
{
<li class="@page.IsAncestorOrSelf(Model, "current", "")">
<a href="@page.Url">@page.Name</a>
</li>
}
</ul>
The above obviously displays the site naviation front end when assigned to a macro and added to a template. That is fine. However, if I wanted to show the same output from this Razor script in the Umbraco back office on a node / document type as a way of previewing to the Nav to the user, what would be the correct / best process to achieve this in order that they would see the same output as the front end when they are on that node in the CMS?
is working on a reply...