(Optional) Manually add links to appear inside the nav.
Attributes
- `classLiCurrent`
CSS class applied to the link that matches the current page.
Default = "".
- `id`
string
Give this control a unique id. Can be accessed in the client DOM (eg, document.getElementById('myid') or in the server DOM using [? $myid ?] or [? $('myid') ?]).
- `includeParent`
bool
If true, then when viewing a page that isn't the root page, the parent page will be included at the start of the nav. Default = true.
- `includeParentClass`
string
CSS class applied to the link included by the includeparent attribute. Used to differentiate from the child links. Default = "parent".
- `includeParentWhenNoChildren`
bool
If both this and includeparent are true, then a link to the parent page will be displayed even if there are no child page links to display. Default = true.
- `rootPage`
string
The root page to populate navigation items from.
Default = "current".
- `showSameLevelWhenNoChildren`
string
When viewing a page with no children, should it render the pages at the same level as the current page?
If a string / page id is specified, this attribute applies for the page specified.
Tutorials
Oncord includes a range of UI Controls to tackle common website navigation elements:
Dynamic Navigation
A navigation menu is said to be dynamic where it reflects the page sitemap structure, updating automatically when Pages are added,
removed, or re-ordered.
Dynamic navigation is usually preferable over a statically coded list of hyperlinks, as it allows non-technical administrators to alter the
navigation without manipulating code.
Primary Navigation
The main "primary" method of navigating a website. The primary navigation menu is usually located within a website header element,
located towards the top of the page.
Fall-back navigation aimed at providing extra navigation items relevant to the users current position on the site. Usually used for sidebar
navigation menus, or pages listed in the footer of the website.
A map of the hierarchy of all pages on the website. A human-readable sitemap is automatically generated on all Oncord websites at
yourwebsitedomain.com/sitemap.
A sitemap.xml file is also generated automatically, at the url yourwebsitedomain.com/sitemap.xml
What's Next?
To get started, click here to learn how to implement a dynamic primary
navigation menu.
Secondary navigation provides extra navigation items to assist the user in navigating the website. This article explains how to create
dynamic secondary navigation on a Oncord powered website.
The most common application for secondary navigation is a sidebar navigation menu. Making navigation dynamic allows it to be automatically populated based on the pages created in the admin console, rather than by using links hard-coded into the design.
The Secondary Navigation Control
A secondary navigation menu can be added using the <navigation:secondary> control. This control generates an unordered list based
on the sitemap. This unordered list reflects page ordering and whether the page is set to display in navigation. The following is an
example of a basic secondary navigation menu:
The following attributes are commonly used with the secondary navigation menu, remember you can also use any HTML ul attributes (width,
class, etc). All secondary navigation attributes can be viewed in the API here.
IncludeParent="true" - This attribute determines whether the parent page is shown in the navigation menu. For example, if we were viewing an "Our Team" page which had the parent page "About Us", if this attribute is true then about us link would be shown at the beginning of the list.
IncludeParentClass="parent" - This attribute defines the css class of the parent list item when IncludeParent="true".
RootPage="" - This attribute can be used to specify an alternate root page for the secondary navigation, otherwise this attribute is defined automatically.
Orientation="vertical" - The orientation of the navigation menu. Can be assigned the values "horizontal" or "vertical".
ID="sidebar_nav" - Sets id of the object - used for the html id attribute and referencing in the parser's document object model. Each Oncord control element should be assigned a unique id.
ClassLiCurrent="current" - This attribute is used for css styling of the current page navigation item.
It's as easy as styling an unordered list.
Each navigation control element in Oncord can be assigned ID and class attributes. This gives the developer the ability to code website navigation just as they would on a standard website, while taking advantage of dynamic list generation.
Defining Class and ID Attributes
Oncord controls can be assigned class and id attributes for styling purposes in the same way as a regular HTML element. For example;
The orientation attribute of the Primary and Secondary navigation controls attaches the class "popoutMenuHorizontal" or "popoutMenuVertical" to the <ul> depending on whether
the attribute has been set to vertical or horizontal. This class removes list styling, padding and margins, sets up float values appropriately and allows for a drop-down menu.
Styling The Current Navigation Item
It's a common practise when coding navigation to change the appearance of the current navigation item to make it clear which page the user is currently
viewing. This is usually done by adding a "selected" or "current" class to the list item that corresponds to the current page. On the Oncord platform this can be achieved by
using the attribute "classlicurrent" on the <navigation:primary> or <navigation:secondary> elements. The previous example can be updated with the classlicurrent attribute
as follows;
Similarily to the "classlicurrent" attribute, the "includeparentclass" attribute can be used on a <navigation:secondary> element to allow CSS targeting of the parent navigation item.
As an example, see the below implementation of a secondary navigation menu. In this example the "includeparentclass" has been set to "parent".