Guide Hierarchy - Optimal way of displaying category tree (with article) on every page? | Community
Skip to main content

Guide Hierarchy - Optimal way of displaying category tree (with article) on every page?

  • June 24, 2019
  • 5 replies
  • 0 views

Hello all,

I'm working on a custom navigation for our front-end Zendesk help center (Guide). Ideally, this navigation will live on all pages -- including the homepage, category page, section page, and article page -- and would utilize a handlebars helper (rather than using Javascript to populate this).

See below screenshot for reference of the navigation that I'd like to implement on our home_page.hbs, category_page.hbs, section_page.hbs and article_page.hbs:

The obvious "Zendesk Helper" would be {{category_tree_with_article}}; two comments on this, however:

- This helper is only available on the homepage
- This helper doesn't seem to scale with a hierarchy of 3+ levels (for Zendesk Guide - Enterprise feature)

Does anyone have a good way of achieving this? Below, I've included my "solution" to the problem (to iterate through at least 2 levels of subsections), but it's messy and most importantly, it doesn't work on section or article pages.

        <ul class="accordion">
{{#each categories}}
{{#if ../has_multiple_categories}}
<li><span class="accordion__title sidenav-item">{{name}}</span>
<ul>
{{#each sections}}
<li {{#if internal}}class="hidden"{{/if}}>
<a class="accordion__title sidenav-item">{{name}} {{#if internal}}<span class="icon-lock" title="{{t 'internal'}}"></span>{{/if}}</a>
<ul>
{{#if articles}}{{#each articles}}<li><a href="{{url}}">{{title}}</a></li>{{/each}}{{/if}}
{{#if sections}}
{{#each sections}}
<li {{#if internal}}class="hidden"{{/if}}>
<span class="accordion__title sidenav-item">{{name}} {{#if internal}}<span class="icon-lock" title="{{t 'internal'}}"></span>{{/if}}</span>
<ul>
{{#if articles}}{{#each articles}}<li><a href="{{url}}">{{title}}</a></li>{{/each}}{{/if}}
</ul>
</li>
{{/each}}
{{/if}}
</ul>
</li>
{{/each}}
</ul>
</li>
{{/if}}
{{/each}}
</ul>

 

TLDR: I need a way to spit out the entire knowledge base category tree (including articles), such as through a Zendesk helper. Ideally, we'd use the same helper on the home_page.hbs, category_page.hbs, section_page.hbs, and article_page.hbs.

5 replies

Trapta
  • June 25, 2019

Hi @Dan Tabibzadeh,

It's not possible using Zendesk helper as Zendesk doesn't provide any. The helpers are restricted to the templates and there is no such helper that will provide you list of categories on section and articles template.

You need to use the API and some JavaScript in order to populate a sidebar like this. You can cache the whole menu in order to enhance speed and refresh the data after certain minutes to prevent API call limit.

Let me know if this helps you.

Team Diziana

 

PS: If you are interested in some sort of plugin to accomplish something similar then you might want to take a look at our Multilevel Menu Plugin here.

It will solve both the purpose of yours: i.e., showing the entire knowledge base category tree on homepage, category, section and article templates and, scale with a heirarchy of 3+ levels.


Lotus11
  • June 25, 2019

Hi Dan,

To achieve this, you can use Zendesk extension 'Side navigation'. It allows you to display categories, sections, and articles on inner pages of your help center.

 


  • Author
  • June 27, 2019

Thanks Trapta and Lotus Themes.

Looks like I'll give building it out via Javascript instead. Appreciate the feedback!


  • November 26, 2019

I just upgraded my Guide plan to the Enterprise level for 6 levels. I'm trying to create a multi-level side menu (to include multiple sections).  Is there really no easy way to accomplish this???  Maybe I'm missing something?


Nicole17
  • November 26, 2019

Hi Victoria - 

There is not an out-of-the-box function in Guide to create a side menu, but the suggestions made by Diziana and Lotus above work well. Both of them are regularly active in the community and can help answer questions if you have any about those solutions.