最近のアップデート後、カスタムナビゲーション項目が表示されなくなった

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 = { title: "Name", help: "Visit our...." };
    I18n.translations.en.js.filters.tags = { title: "Tags", help: "Tags" };

    Discourse.NavItem.reopenClass({
      buildList : function(category, args) {
        var list = this._super(category, args);
        if(!category) {
          list.push(Discourse.ExternalNavItem.create({href: 'http://forum.com/tags', name: 'tags'}));
          list.push(Discourse.ExternalNavItem.create({href: 'https://forum.com/something', name: 'name'}));
          list.push(Discourse.ExternalNavItem.create({href: 'https://forum.com/t/thread-url/193454#heading--name', name: 'name'}));
        }
        return list;
      }
    });
  </script>

does not exist in core anymore. If you want to add items to the top nav menu, you can use this component

Thanks Joe - added!

Only thing is it seems to be stripping out the #jump to?

forum.com/t/thread-url/193454#heading--name

Edit: it seems it’s there and if you copy and pate the URL it works fine, but clicking on it in the nav, it gets stripped out and you just go to the top of the topic. Any ideas why?

Sounds like

https://meta.discourse.org/t/deep-linking-to-headings-anchors/47552/36?u=falco

Thanks Rafael, I’m pretty sure it used to work so I’m guessing it’s a recent change…

This was tricky to track, but @j.jaffeux :mage: added a fix for that here

It should work if your Discourse is up to date.

Fantastic - it works!!!

Thank you @Johani and @j.jaffeux :orange_heart: