Navigation

Create interactive navigation menus anywhere in your help center.

The Navigation extension allows you to create dynamic, interactive navigation elements anywhere in your help center quickly and easily without being limited by Zendesk’s native page template and objects.

Category lists

Categories presented in collapsible tabs
View code
a54af0578ad13434ec6f20197b137f27987ddd94b5e00643216628dcd02665f2a5042ce35b73d9d2bc36de1af911e7d46a70736bb89ebb9b8fca52b27a1ab95bb261409057ae2ac5b77ba6b9d302259b5eb635368e74c549ad40824b4c6ae6caf6cfa8e350a88da45bd4c76c18af54cde219649399e82ade5163fb58bd864e72ff63daac8622bad9e7e72bf1784144fc3ac7e3064d507f45d4bce4d5f6fc865c1faf5beade3db5d4b1437637f43195c17f0d315189cf88f4f029853c380ba3817456f64677708a132b4b52aae821bdc504a9c253226364c0321b90417f77384d5deb0d817d9700f70bc1e65d967909e756cad6a4a88bf2dff5c640b3aa863d6fce4331b5d29d71c81bbfca1488d59091718808390cf6848790d288be4d69d07307017c50a1c3eb9807d245d9a144e976e0035a3c891be813909c2f866a9ba7ad11efd65531cc00de1df884657e7de1a438402b23910049c0c0299e893dfe33106810ab592faa0c79ab9d3c2177cb9b7880450fb7e4c1a883c562329c1426f93242d9c9bd1830f5f8e123546bb2956e9733ae8db190b9c80a94621a6b2759cdfb0024acb1a1223f7caefbd9e150705fd7c0b76a53ac836f05fa6c6350939c468abe8fac710014fb857b27a229e0d991f0a76e9d0654d972949537c93f067af9ba758f1a7c110ab2836cd5a1a9c15edb622aff5801ac6ceacdf15e33c222cc07e20dcc96213215dbb570a428c443d98241ebe8945a4edc662643d6aa63417cd019735fac0f9a01dee570dabe943f529d2b2a5c8de52c7b2279a962b7da386ebb0824e100c419da5d5fc1ef486886fa8aef3c2e6831740a5f74fe1dd9a1d7f77b8f493c2ceda3b4056d8137f9be0884c61c7fe6eee7f287f14c7575beac5f120655d1774d756c3145f47d9dd1f950b3b9d591b1a815d68a4cddeeb5bb1314c4ab41c812514e2841a27d979f0a41400ddfed5719f9071e95c8e9ed1927deb468e33404b0a98330887604e57ec5b325c8962295894ae63e80be95be7964164b527a9950ab80a7a124d3179ada79bbaad6fa1a2fea4f0a7b80e236153e29acaf58a29cd6079a2bd0a823209ec39fb337a28cecb357ce441a8d94fded3e120584644d5bea8dca9cef49cd5c955061be5bc18c5624bb93d046b90b5ec21df44b7b67aeff3423217e6720c16f1c2a54e2907069b2f55df0377a4ad7c239dd8fd07f0a00fb06e6f9d4704e9826f427b7820ec2e983f58ad3e766a51f22ea7e74d614b8b506586ca72b847675c8aa8764b001b0dff3a6c78a8e599ca018a8e0570b97fd8fd9661935e8ee52df34aaf3811f3ab5dcc9dcbdb2da9b3b0cacc32276974c244d1b288c62d037d6d7f30acd252459a0e2b4a8ab5cd2d21a479528f7c20620ffd57c042812b8e611e04b6a4ffbd9e915b38572ed166b28e2a56a17bd31b37e377c18b84ab65e5bfbc3f9d36f292d703fc84ab0472311617696fd2c769dfcf3e7eb9f64cb0ad4f815eca92f1bb78d44d45894679156203cec25cfc07721852a30b172aa69bf789cf632aa4e1aee36de06760cbc4cbe0ba54b88ea3a3ffc652f2bafe63e74217a8f76ba8e1c5f83eed2a3a223ef51fae3503c71d3f8415390f8e720a8bbd5aa44b63fd7bae6bbf8f3a585ff9fe8d9b8f4faeaaa90478d53c1c0f927407506aea6d130dde9edb794e72662a252b2703df53a6bc339adea646485e095605e3d8344ad0e7d384e63e5da999c8322e967abac8f460acef74ab457da1bb0af60f35c9f7c900ed6c93debbd8e32d959cce61b276ad4510e62f07b34211f76a97c5af34bc1a56d3a42b9cf3ad98c5e5671ab84af3f510b413bb2ad01d0c0f13e17836a81e21cb5e47ee436314b97ee71adad4052e7f0769d6462cf63ec5cdd7d21ebc4e63e7a5ac43ee86e25b54c90c83853eefacccee437bb0458c0c19342e2

Section lists

Sections presented in groups

Article lists

Articles in a two-column list
Navigation menu containing sections and articles

Additional examples can be seen throughout our themes and in our Pattern Library.

The Navigation extension is bundled into all of our themes by default, so you can start using it straight away. You can find the source code for the extension within the extension-navigation.(min.)js file in the theme’s Assets folder.

Our themes allow you to add pre-built navigation menus on the Category, Section and Article pages using theme settings.

  1. In Zendesk Guide, click the Customize design icon (Customize icon) in the sidebar.

  2. Click Customize on the theme you want to edit.

  3. Expand the Category page elements, Section page elements or Article page elements sections and select a navigation style from the sidebar navigation setting.

Each setting includes a Custom template option which, when selected, allows you to use one of the many navigation patterns from our library.

Use data-element="navigation" on an element to create a dynamic navigation menu.

<div data-element="navigation" data-template="my-custom-template"></div>

<template id="tmpl-my-custom-template">
  ...
</template>

If data attributes are used you will need to ensure that the allow unsafe HTML setting is enabled within Zendesk Guide.

The Navigation extension can be initialized using JavaScript:

<div id="navigation-element">...</div>

<template id="tmpl-my-custom-template">
  ...
</template>

<script type="text/javascript">
  ready(function() {
    var navigationElement = document.getElementById('navigation-element');
    if (!navigationElement) return;

    new Navigation(navigationElement, {
      template: 'my-custom-template',
      // Other options go here
    });
  });
</script>

Custom micro-templates

When using a custom micro-template, each object has an additional property (isActive) which specifies whether it’s active (meaning it, or one of its child or descendant objects, is being viewed).

<ul class="list-unstyled">
  <% categories.forEach(function(category) { %>
    <li>
      <a class="<% if (category.isActive) { %> font-bold<% } %>" href="<%= category.html_url %>">
        <%= category.name %>
      </a>
    </li>
  <% }) %>
</ul>

You can also access the IDs of the active category, section or article (if any) using activeCategoryId, activeSectionId and activeArticleId:

<ul class="list-unstyled">
  <% sections.forEach(function(section) { %>
    <li>
      <a class="<% if (section.id === activeSectionId) { %> font-bold<% } %>" href="<%= section.html_url %>">
        <%= section.name %>
      </a>
    </li>
  <% }) %>
</ul>

This is useful if you’re creating navigation menus with nested subsections, where two or more sections may have an isActive value of true, as activeSectionId represents the section actually being viewed (if any).

Additional custom data can be supplied to the template using the templateData option described below.

<nav id="navigation"></nav>

<script type="text/javascript">
  ready(function() {
    new Navigation(document.getElementById('navigation'), {
      templateData: {
        foo: 'bar'
      }
    });
  });
</script>

Which would allow the value of foo to be accessed in a template using <%= foo %>.

Options

Options can be passed via data attributes or JavaScript.

For data attributes, append the option name to data- and use kebab case instead of camel case.

Name Type Default Description
collection object {} An object containing an array of objects representing categories, sections, articles, topics and/or posts. If the collection is not provided, the extension will fetch the objects specified in the option below from the Zendesk REST API.
objects array [
 'categories',
 'sections',
 'articles'
]
The list of object types to fetch from the REST API and make available to the template.
properties array Object properties The list of object properties from the REST API response to pass to the template.
categoryId string
number
null
null Only return objects from a specific category.
sectionId string
number
null
null Only return objects from a specific section.
topicId string
number
null
null Only return objects from a specific topic.
labels array [] Only return articles with specific labels.
filter object {} An object containing references to custom filtering functions for each object type, where the key is the type of object (e.g., 'categories'). The default filtering functions filter out draft articles.
sort object {} An object containing references to custom sorting functions for each object type, where the key is the type of object (e.g., 'categories').
sortOrder string 'asc' The sort order to use for each object collection.
template string
null
null The name of the template to use.
templateData object {} Additional data to expose to the template.

The collection object containing categories, sections, article, topics and/or posts is sorted and organized such that parent objects have access to their children.

<% categories.forEach(function(category) { %>
  <% category.sections.forEach(function(section) { %> // This is a child section
     ...
     <% section.sections.forEach(function(subsection) { %> // This is a subsection
       ...
    <% }) %>
  <% }) %>
<% }) %>

Object properties

The following object properties are passed to the template by default:

Name Description
id The ID of the object.
title The title of the object (articles and posts).
name The title of the object (categories, sections and topics).
description The description of the object categories, section and topics).
html_url The URL of the object.
position The position of the object (categories, sections, articles and topics).
promoted Whether or not the object is promoted (articles only).
pinned Whether or not the object is pinned (posts only).
draft Whether or not the object is a draft (articles only).
section_id The ID of the parent section (articles only).
parent_section_id The ID of the parent section (sections only).
category_id The ID of the parent or ancestor category (sections only).
topic_id The ID of the parent topic (posts only).
created_at The date and time that the object was created.

Events

Class Properties
navigation:render Fires when the navigation menu has been rendered.

Related extensions

Animations and transitions Free

Animations and transitions

Add engaging animation and transition effects to elements.

Carousels Free

Carousels

Present content in well-defined and easy to follow steps.

Content blocks and icons Free

Content blocks and icons

Display icons against categories, sections and articles.