How to make some categories like Bugs and Features here visible in top menu?

How to make some categories like Bugs and Features here visible in top menu?

If you view the source on this page you can see the script that adds bugs and features to the top menu - it’s the last script tag on the page.

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

  I18n.translations[I18n.locale].js.filters.bugs = { title: "Bugs", help: "Open Bugs" };
  I18n.translations[I18n.locale].js.filters.features = { title: "Features", help: "Open Feature Requests" };
     
  Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
      var list = this._super(category, args);
      if(!category) {
        list.push(Discourse.ExternalNavItem.create({href: '/c/bug/l/top/quarterly?status=open', name: 'bugs'}));
        list.push(Discourse.ExternalNavItem.create({href: '/category/feature?order=op_likes&status=open', name: 'features'}));
      }
      return list;
    }
  });
  </script>
5 Likes

If you only want to add a category, not a special filtered view, you can also edit the site setting top menu and add something like category/feature to it.

3 Likes

Thanks guys! Thanks guys!

Where do I need to put this adapted script?

Admin > Customize > CSS/HTML

Create a new CSS and add the code in </body>

4 Likes

This might be a better solution for you. To add the ‘Persian’ category I added ‘category/persian’ to basic setup/top menu.

4 Likes

We learn something everyday with Discourse

2 Likes

I’m sorry, but your methods doesn’t work for me.

  1. I took the category name from — “offtopik”

  2. Then put it into “category/offtopik”

  3. It does appeared on top menu

BUT
it points to http://domain.ru/c/null - NULL
it doesn’t use normal name.

It looks like you need to use the category name, not the slug.

7 Likes

Yeeaaah! It works! Thanks

1 Like

Looks like magic is broken. I can’t add more sub-categories in Top menu

The best way to do this now is with a theme component:

6 Likes