MenuPart
The MenuPart allows you to insert a site navigation menu anywhere in your site. It is a ContentPart so it can be dragged and dropped into any zone. It renders using Adapters so you can opt to hard-code it into your template.
Available Properties
Property | Description |
---|---|
MenuTitleDisplayMode | Controls how the given Title field is rendered (if at all). |
MenuStartFromLevel | MenuPart will recursively navigate up the site tree until it reaches a page with this specified level from the root. Negative values can be used to specify recursion limits relative to the current page. For example, -1 will cause only the pages that directly parent the current page to be shown in the navigation menu. |
MenuShowSibilings | Determines when sibiling pages are rendered in the navigation menu. |
MenuDontLinkTopLevel | Determines if the top-level items should be a link or static text. You can set this to true to disable linking of the top-level items. This can be useful to render logical groupings in your navigation menu. |
MenuFlattenTopLevel | If true, items at the top level are at the same list level as second-level items. This can be useful to render logical groupings in your navigation menu. |
You can set various CSS classes on the menu items.
Example
Example: Using MenuPart Programmatically
<div class="noprint col-sm-3"> @{ var p = new N2.Web.MenuPart() { MenuTitleDisplayMode = N2.Web.MenuPartBase.TitleDisplayOptions.None, // do not render the Title MenuStartFromLevel = 2, MenuShowSibilings = N2.Web.MenuPartBase.SibilingDisplayOptions.Always, MenuDontLinkTopLevel = false, MenuFlattenTopLevel = true }; } @Html.Raw(new N2.Web.MenuPartRenderer(p).GetHtml()) @{ Html.DroppableZone("BelowNavigation").Render(); } </div>