Constellation.Feature.Navigation is a developer-accelerator for Sitecore that provides a framework for building the three most common types of page navigation and menu systems found on the web:
Site-wide “Declared” Navigation
This navigation exists on all pages of a site, and includes the “header” area as well as the “footer” area. While terms for this kind of menu system tend to be “primary,” “static,” “footer,” “utility,” and “tools,” within the library we call this “Declared” navigation to avoid confusion. Aside from their pervasive appearance throughout the site, Declared navigation is also explicitly laid out by marketers and does not necessarily reflect the structure of the site’s content tree.
This navigation is tree-like and represents the current page, its parent, its siblings, its children, and possibly its grandchildren. It relies upon the Sitecore Content Tree for context and hierarchy. Terms for this kind of navigation include “section,” accordion,” and “folding” for clarity the library calls this type of menu system “Branch” navigation.
Similar to section navigation, Breadcrumb navigation tells you where you are in the Content Tree relative to the site’s home page. This navigation displays the current page and every ancestor of it including the home page.
Note that this library does not support the concept of “visitor history” style breadcrumbs. History navigation tends to be extremely dependent upon the exact Sitecore implementation and isn’t a good candidate for “best practices”.
What’s in the Box
The primary code components are a series of Repositories, one for each of the navigation types described above. Each Repository requires some context objects, and provides output in the form of View Models ready for use by standard ASP.NET MVC Views.
Within Sitecore there are a number of Data Templates added to the system. For “Declared” Navigation there are a series of “must use” templates that allow for the creation of the following:
- Navigation bars (such as described in Bootstrap)
- Drop-down link lists
- Mega menus
- Navigation columns (such as used in footers)
For “Branch” and “Breadcrumb” navigation there is a supplied Data Template that provides an explicit field for the text that should be displayed when a page is referenced in branch or breadcrumb navigation menus. Anything that might show up on these menus needs to inherit from this template, as described later.
What’s Not in the Box
Programmers may be surprised to find this library does not include Controllers or Views. This is intentional. We want this library to support a broad range of applications, from vast differences in HTML markup to async JSON.
Features and Use
- Preparing your Page Templates for Use
- Creating a Breadcrumb Rendering
- Creating a Branch Navigation Rendering
- Declared Navigation Strategy
- Creating a Declared Navigation Rendering
Constellation.Feature.Navigation is managed via NuGet.
In Visual Studio, fire up the Package Manager console and install into the appropriate Sitecore projects:
PM:> Install-Package Constellation.Feature.Navigation
After installation, it’s very important that you build and deploy your solution before starting development. The act of deploying will add some new required Sitecore Items to your installation that are prerequisites for Information Architecture and use.
Review the links above for examples on how to create navigation using this library. You can also check out the source code available on GitHub.