Discourse论坛搭建 在顶部菜单添加未解决按钮

我是新手 ,对我来说很有用,来源于官网,感谢原作者。

将JS代码粘贴到CSS / HTML 部分,会在顶层菜单中创建两个附加链接: 类别 未解决

<script>
Discourse.ExternalNavItem = Discourse.NavItem.extend({
href : function() {
return this.get('href');
}.property('href')
});
 
I18n.translations.en.js.filters.unresolved = { title: "类别", help: "类别" };
I18n.translations.en.js.filters.unresolved = { title: "未解决", help: "未解决的主题" };
 
Discourse.NavItem.reopenClass({
buildList : function(category, args) {
var list = this._super(category, args);
if(!category) {
list.push(Discourse.ExternalNavItem.create({href: '/latest?solved=no', name: 'unresolved'}));
} else {
list.push(Discourse.ExternalNavItem.create({href: '/c/'+category.slug+'?solved=no', name: 'category'}));
}
return list;
}
});
</script>

来源:Add Unsolved button to top menu using custom HTML - theme developers - Discourse Meta