How to display {{navigation-bar}} on users page

Right now, I am working on a theme component requiring {{navigation-bar}} on the /u route.

The goal is to add a navigation bar to the users page, so that the user can navigate to and from latest and categories while still staying on users page.

I’m using users-top pugin outlet to show the component and adding custom nav item using a hack.(addNavigationBarItem doesn’t seem to work for custom navigation-bar) but I’m getting console errors.

I would like to know what I’m missing here and also, if there’s a simpler way to achieve this

Here’s my code.

2 Likes

Ok I got this. Actually @angus helped me out with this. The way to pass navItems to the {{navigation-bar}} is

const filterMode = 'users';
const navItems = Discourse.NavItem.buildList(null, { filterMode });

 this.setProperties({
      navItems,
      filterMode
    });

The key here was to add a filterMode. With this the addNavigationBarItem also works.

5 Likes