# 在类别主页隐藏第三级类别而不破坏布局的选项

**URL:** <https://meta.discourse.org/t/option-to-hide-3rd-level-categories-on-the-categories-homepage-without-losing-the-layout/410242>\
**Category:** Feature\
**Tags:** categories\
**Created:** [2026年八月17日 17:41 UTC](https://meta.discourse.org/t/option-to-hide-3rd-level-categories-on-the-categories-homepage-without-losing-the-layout/410242 "2026-08-17T17:41:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Tonja](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tonja/32/566727_2.png) [@Tonja](https://meta.discourse.org/u/Tonja)\
**Post date:** [2026年八月17日 17:41 UTC](https://meta.discourse.org/t/option-to-hide-3rd-level-categories-on-the-categories-homepage-without-losing-the-layout/410242/1 "2026-08-17T17:41:43Z")

</div>

我们使用一种深层的两级分类结构（我们城市的所有公共图书馆及其各自的分支，外加一个拥有自己顶级分类的中心图书馆）。最近，我们需要在某些分类分支中引入第三级嵌套。

一旦树中的任何分类拥有孙级分类，分类主页就会切换其渲染模式：不再显示紧凑的方块网格（父分类及其直接子分类列在其中），而是将所有分类渲染为长长的单列列表。这使得主页变得极长，对于我们 ~1,200 名员工用户来说很难快速浏览。

这似乎由相关讨论中描述的 `isGrandParent` 属性控制：[When you add an additional nesting level, all categories, including child categories, are displayed on the categories page](https://meta.discourse.org/t/when-you-add-an-additional-nesting-level-all-categories-including-child-categories-are-displayed-on-the-categories-page/195842)

**我们希望实现的效果**

**我们的首选方案** ：即使分类拥有第三级嵌套，也能保持标准的“方块”主页布局——例如，通过简单地在主页上不显示孙级分类（它们仍可通过父分类页面访问）。

**或者** ，在分类主页上直接提供原生的、可展开/折叠的分类视图，以便用户仅展开他们需要的分支，而不是将所有内容平铺列出。

**为什么我们要求原生/官方解决方案**

我们知道存在主题组件/CSS 或 JS 的变通方法（例如，通过 `modifyClass` 覆盖 `isGrandParent`），这些方法在上述旧讨论中已有提及。我们更倾向于不采用这种方法：我们内部缺乏深入的前端专业知识，并且担心如果自行覆盖核心渲染逻辑，会在未来的 Discourse 更新中出现意外的副作用或破坏。受支持的设置或官方选项对我们来说长期维护会更安全。

我们知道 Discourse 并不正式推荐深层嵌套，但对于我们的组织结构（多个机构，每个机构有多个物理位置，每个位置都需要自己的空间）来说，这是不可或缺的。

一种受支持的、用于控制这些情况主页显示的方法将大有帮助。我们相信，自 2021 年以来，其他组织可能也有隐藏第三级分类的需求，对吗？

附件截图：我们当前的两级主页布局

 ![wanted](https://global.discourse-cdn.com/meta/original/4X/a/f/7/af710f383678994c75af55ef5b177543d25538c8.jpeg)

以及引入第三级后当前出现问题的样子。

 ![status quo](https://global.discourse-cdn.com/meta/original/4X/7/2/2/7227dc14ef7cd6b58e82040cbd3f23094b2afdb2.png)

---

_[View the full topic](https://meta.discourse.org/t/option-to-hide-3rd-level-categories-on-the-categories-homepage-without-losing-the-layout/410242)._
