# 缩进子类别

**URL:** https://meta.discourse.org/t/indented-subcategories/393838
**Category:** Theme component
**Tags:** sidebar
**Created:** [2026年一月20日 03:22 UTC](https://meta.discourse.org/t/indented-subcategories/393838 "2026-01-20T03:22:24Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [2026年一月20日 03:22 UTC](https://meta.discourse.org/t/indented-subcategories/393838/1 "2026-01-20T03:22:24Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **摘要** | 自动缩进侧边栏中的子类别 |
| 👓 | **预览** | [https://discourse.theme-creator.io/theme/Lilly/discourse-indented-subcategories](https://discourse.theme-creator.io/theme/Lilly/discourse-indented-subcategories) |
| 🛠 | **代码库** | [https://github.com/Lillinator/indented-subcategories](https://github.com/Lillinator/indented-subcategories) |
| ❓ | **安装指南** | [如何安装主题或主题组件](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |

安装此主题组件

## ℹ 概述

这个简单的主题组件会自动缩进侧边栏中的所有子类别——适用于桌面、平板和移动视口尺寸。

有一个设置项用于更改缩进大小——默认值为 `1em`，最小值为 `0.5em`，最大值为 `3em`。

**设置：**

 ![Screenshot 2026-01-19 at 6.39.28 PM](https://global.discourse-cdn.com/meta/original/4X/0/c/8/0c842f34894228a60c565a0fcaf7a650d3cfc06d.png)

**侧边栏示例结果截图：**

 ![Screenshot 2026-01-20 at 2.45.33 AM](https://global.discourse-cdn.com/meta/original/4X/2/e/3/2e3f24ebf62cfd947aace78479d81313b43e2d12.png)

* * *

### 💡 注意事项

此主题组件仅适用于单级子类别。如果您的论坛启用了多级子类别（子子类别），此组件可能会失效，或者至少在侧边栏中显示效果不佳。

此组件替代了现已弃用的 [https://meta.discourse.org/t/indented-nested-sidebar-categories-or-subcategories/329437。](https://meta.discourse.org/t/indented-nested-sidebar-categories-or-subcategories/329437%E3%80%82)

* * *
 **[查看我的其他 Discourse 作品](https://meta.discourse.org/filter?q=category%3Acustomization%20created-by%3ALilly%20order%3Acreated)**

---

_[View the full topic](https://meta.discourse.org/t/indented-subcategories/393838)._
