How to add /users on Top Menu?


(filippo) #1

/users page works properly as a leaderboard. I was willing to add it on top menu.

Is there a easy way to do it? Maybe without code :stuck_out_tongue:


(Joe Buhlig) #2

Try this in Customize - Theme - </head>

<script>
  Discourse.ExternalNavItem = Discourse.NavItem.extend({
    href : function() {
      return this.get('href');
    }.property('href')
  });

  I18n.translations.en.js.filters.users = { title: "Users", help: "User leaderboard" };

  Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
      var list = this._super(category, args);
      list.push(Discourse.ExternalNavItem.create({href: '/users', name: 'users'}));
      return list;
    }
  });
</script>

(Sam Saffron) #3

This is sort of there, the big challenge is keeping that nav around when you hit directory, far trickier problem.


(Christoph) #4

Would it be a big deal to extend the functionality of the top menu site setting so that it can handle any url path (based on the site url) in a similar fashion as it now handles category/<category_name>?


(Sam Saffron) #5

This is now doable in a theme component.

See: Add /users to top nav

At the moment, yes, it would be a very complex change.