自定义导航项在最近更新后不再显示

我使用这段代码(在编辑 CSS/HTML 自定义页面的 /head 选项卡中)向菜单添加了一些额外项目,但它在最近一次更新后停止工作了——有人知道原因吗?

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

    I18n.translations.en.js.filters.first_name_here = { title: "名称", help: "再次输入名称" };
    I18n.translations.en.js.filters.second_name_here = { title: "名称", help: "访问我们的……" };
    I18n.translations.en.js.filters.tags = { title: "标签", help: "标签" };

    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>

已不再存在于核心中。如果您想向顶部导航菜单添加项目,可以使用此组件:

谢谢 Joe,已添加!

唯一的问题是,它似乎移除了 #jump 部分?

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

编辑:看起来它其实还在,如果你复制并粘贴该 URL,它可以正常工作,但在导航栏中点击它时,这部分会被移除,导致你直接跳转到话题顶部。有人知道原因吗?

听起来像是

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

谢谢拉斐尔,我很确定以前是有效的,所以我猜这是最近的变化。

这个问题很难追踪,但 @j.jaffeux :mage: 在此处添加了一个修复:

如果您的 Discourse 已更新至最新版本,它应该可以正常工作。

太棒了——它起作用了!!!

感谢 @Johani@j.jaffeux :orange_heart: