I can’t figure out how to get a subcategory (“Build your own teen innovation challenge” in this case) to stop showing up (the arrow) on the main category page. I’ve tried several things. Can you help?
I can’t find a site setting for this but you could hide it using CSS in a theme component.
Could use this CSS:
.category .subcategories {
display: none;
}
If you also don’t want them listed on the hamburger drop-down menu:
.category .subcategories, .category-links .category-link.subcategory {
display: none;
}
So I’m familiar with CSS but not sure where to add it for Discourse to use it.
On the mobile so from memory but it’s something like this:
Admin
Customise
Themes
Components
Install (add name for new component)
Edit HTML/CSS
Apply theme component to themes
Another option… you could assign the sub-category to a group and restrict visibility to that group. Just fyi.
Would that have other consequences beyond the main categories page? I’ve not used groups yet.
You create a group called “Team Kids” then define who can join/view/participate in that group.
- Add a description, allow certain people to be “owners” who can moderate the group vs regular members.
Create a Category as we did for “Classes & Events”
- assign read/write/view access to the group under /Edit /Security for the category
- Notice how you can also change settings for “Everyone”, which includes all anonymous guests on the web, etc.
OR
Simply stop the sub-category from showing up for @everyone. We restrict categories to only @trust_level_0 users, which means registered users who are logged in. Or, @trust_level_1 users who’ve been active on the platform a few weeks. These trust levels are actually all groups, too.
Hopefully this gives you some ideas on restricting your categories, rather than simply allowing them all to be crawled by google searches and viewed by random people online.
These are all very good suggestions; thank you. Ultimately, I was trying to create an Events group and then, in some cases, subgroups for the events underneath them. It’s an archive sub at this point, so I don’t need it front and center but don’t want to delete it.
Combined with @manuel’s CSS above, this worked perfectly. Thank you.
Category Group access is defined within each specific category, so you have total control over any access a group will (or will not) actually have to a category. “Trust Levels” of users in Discourse, Staff, Admins, Moderators… all of these are literally just groups.
This has been educational for me, so thank you, but I think you are solving a different problem to the one described in the original post. I get the impression he just wanted rid of the sub-category from the main categories page, but wanted it to behave normally otherwise.
These are the only ways I know to suppress a category: by group. The trust levels are all groups. Use or ignore as you please.
您好,
在我的情况下,我调用了隐藏选项将 2 个子类别嵌套在父类别下,在这种情况下,只有最后一个嵌套的子类别被隐藏。是否有办法通过 CSS 隐藏两层深度?
例如:
父类别
子类别 1 - 隐藏
子类别 2 - 隐藏
上面场景中提供的 CSS 只隐藏了子类别 2。
.category .subcategories {
display: none;
}
谢谢。
感谢您的回复!
注意:我已调用隐藏功能,允许额外嵌套一个类别,总共 3 个,而不是 2 个。
这里有一个例子可能能更好地说明这个问题:
例如,主页:
测试(类别)
- 测试 - 子 1(父测试类别的嵌套类别)
在这种情况下,
.category .subcategories {
display: none;
}
可以正常工作。

正如您所见,嵌套的测试 - 子 1 类别未显示。
如果我添加另一个嵌套子类别:
测试 - 子 2 类别,以测试 - 子 1 类别作为其父类别:
正如您在上面的图片中看到的,测试 - 子 2 被隐藏了
根据 CSS 代码,但测试 - 子 1 不再被隐藏。
现在问题有两个方面:
我可以隐藏测试 - 子 1 标题,将其类设置为 display: none,但这也会隐藏主页上的所有父类别。
第二个问题是,即使我能隔离并仅隐藏测试 - 子 1 嵌套类别,它所占用的空间仍然存在,并且会造成问题。我需要在主页上再添加大约 20 个类别,每个类别有两个嵌套子类别。
理想情况下,我只想让最终用户能够点击测试类别并访问其他嵌套类别等,这可以通过
在类别主题上方显示子类别列表。
并将子类别列表样式设置为例如框等。
如果将来我想在测试类别之后定位主页上的另一个类别,我不希望出现 20 行空白换行等。
有什么想法吗?
试试这个 Theme component
效果很好 - 谢谢!



