# How to add a topic in top nav in a specific category?

**URL:** https://meta.discourse.org/t/how-to-add-a-topic-in-top-nav-in-a-specific-category/87028
**Category:** Support
**Created:** [9 mei 2018 om 01:59 UTC](https://meta.discourse.org/t/how-to-add-a-topic-in-top-nav-in-a-specific-category/87028 "2018-05-09T01:59:47Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![HeyRR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heyrr/32/192157_2.png) [@HeyRR](https://meta.discourse.org/u/HeyRR)
#### Post date: [25 juli 2020 om 19:52 UTC](https://meta.discourse.org/t/how-to-add-a-topic-in-top-nav-in-a-specific-category/87028/14 "2020-07-25T19:52:06Z")

</div>

This seems no-longer works after deprecation of `Discourse.NavItem` , and someone mentioned in this post that [Custom top navigation links](https://meta.discourse.org/t/custom-top-navigation-links/87225) can do the trick:

> [@Custom nav items no longer showing after recent update](https://meta.discourse.org/t/custom-nav-items-no-longer-showing-after-recent-update/133838):
>
> I use this code (in the /head tab of the edit CSS/HTML customisation page) to add some additional items to the menu, however it’s stopped working after a recent update - anybody know why? \<script\> Discourse.ExternalNavItem = Discourse.NavItem.extend({ href : function() { return this.get('href'); }.property('href') }); I18n.translations.en.js.filters.first\_name\_here = { title: "Name", help: "Name again" }; I18n.translations.en.js.filters.second\_name\_here = …

However, this component does not dynamic link where you want to check the link url based on current location.  
For my use-case, I want to set different link for mainpage and sub-categories, e.g. to show an unfinished/finished tag filter nav item based on current categories, I used to able to use below code but now is not working:

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

  I18n.translations.en.js.filters.unfinished = { title: "tbc", help: "placeholder" };
  I18n.translations.en.js.filters.finished = { title: "finished", help: "placeholder" };

  Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
      var list = this._super(category, args);
      var url = category ? category.url : "";
      // Main menu and 2 specific categories will have those 2 nav items with different url
      if(!category || (category && url && (url.includes("mix") || url.includes("other")))) {
        var tbc_url = category ? "/tags" + url + "/tbc" : "/tags/tbc";
        var finish_url = category ? "/tags" + url + "/finished" : "/tags/finished";
        
        list.push(Discourse.ExternalNavItem.create({href: tbc_url, name: 'tbc'}));
        list.push(Discourse.ExternalNavItem.create({href: finish_url, name: 'finish'}));
      }
      return list;
    }
  });
</script>

```

Can someone help me on how can I update this code based on current `navigation-item` component? Or a more general question, how can I find the current usage of the replacement of `Discourse.NavItem`?

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/how-to-add-a-topic-in-top-nav-in-a-specific-category/87028)._
