Profile picture Schedule a Meeting
c a n d l a n d . n e t

N2cms Navigation Options on a MVC Site

Dusty Candland | |

Add the n2 SlidingCurtain control with a DragDropControlPanel control inside it after the opening body tag. This will link to the editing system of n2cms.

<n2:SlidingCurtain ID="SlidingCurtain1" runat="server"> <n2:DragDropControlPanel ID="DragDropControlPanel1" runat="server" /> </n2:SlidingCurtain>

Now there are a bunch of N2 functions that can be used to interface with the navigation system.

To setup the menu the following can be used, the first list item shows a link to the home page. The second list item shows the sub pages.

Next to setup the sub navigation something like this could be used.

<%= N2.Utility.Evaluate(N2.Find.AtLevel(N2.Find.CurrentPage, N2.Find.StartPage, 2), "Title") %>

    <%= N2.Web.Tree.Between(N2.Find.CurrentPage, N2.Find.StartPage, true, 2).Filters(new N2.Collections.NavigationFilter()).ExcludeRoot(true) %>

Bread crumbs can be setup using.

<% foreach(N2.ContentItem item in N2.Find.EnumerateBetween(N2.Find.StartPage, N2.Find.CurrentPage, false)) { %> <%= N2.Web.Link.To(item) %> / <% } %> <%= N2.Utility.Evaluate(N2.Find.CurrentPage, "Title") %>

Lastly, you can update the page title using something similar to what’s been used above.

<%= N2.Utility.Evaluate(N2.Find.CurrentPage, "Title") %><asp:ContentPlaceHolder ID="TitleContent" runat="server" />

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: