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.
مرحباً،
في وضعي الحالي، قمت بتفعيل الخيار المخفي لتضمين فئتين فرعيتين تحت فئة رئيسية، وفي هذه الحالة، الفئة الفرعية الأخيرة فقط هي المخفية. هل هناك طريقة، عبر 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
عمل بشكل جيد - شكرا لك!



