¿Cómo suprimir una subcategoría de la lista de categorías?

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?

2 Me gusta

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;
}
3 Me gusta

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

2 Me gusta

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.

2 Me gusta

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.

1 me gusta

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.

Hola,

En mi situación, invoqué la opción oculta para anidar 2 subcategorías bajo una principal y en esa situación solo la última subcategoría anidada está oculta. ¿Hay alguna manera, a través de CSS, de ocultar dos niveles de profundidad?
por ejemplo:
Categoría principal
subcategoría 1 - ocultar
subcategoría 2 - ocultar

El CSS proporcionado aquí en el escenario anterior solo oculta la subcategoría 2.

.category .subcategories {
      display: none;
    }

Gracias.

Tendrías que inspeccionar el elemento adicional con las herramientas de desarrollador de tu navegador y luego agregar su clase a la declaración de estilo.

¡Gracias por la respuesta!

Nota: He invocado la función oculta que permite una categoría anidada adicional, 3 en total frente a 2.

Aquí hay un ejemplo que podría ilustrar mejor el problema:
por ejemplo, Página principal:
Prueba (Categoría)

  • Prueba - Sub 1 (Categoría anidada de la Categoría de Prueba Principal)
    En este escenario,
.category .subcategories {
      display: none;
    }

funciona bien.
image
Como puedes ver, la categoría anidada prueba - sub 1 no se muestra.

Si agrego otra subcategoría anidada:
categoría prueba - sub 2, con sub 1 como su padre:


como puedes ver en la imagen de arriba, prueba - sub 2 está oculta
según el código CSS, pero prueba - sub 1 ya no está oculta.

El problema ahora es doble:
Puedo ocultar el título prueba - sub 1, estableciendo su clase en display: none, pero esto también oculta todas las categorías principales en la página principal.
El segundo problema es que, incluso si pudiera aislar y ocultar solo la categoría anidada prueba - sub 1, el espacio que ocupa todavía está allí y será problemático. Necesito tener unas 20 categorías más en la página principal con dos subcategorías anidadas cada una.
Idealmente, solo quiero que el usuario final pueda hacer clic en la Categoría de Prueba y tener acceso a las otras Categorías anidadas, etc., lo que se logra fácilmente, a través de
Mostrar lista de subcategorías encima de los temas en esta categoría.
y estableciendo: estilos de lista de subcategorías a, por ejemplo, cajas, etc.

Si en algún momento quiero posicionar otra Categoría de página principal después de la Categoría de Prueba, no quiero 20 filas de saltos de línea en blanco, etc.

¿Opiniones?

Prueba este Theme component

¡Funcionó bien - gracias!