Come posso nascondere una sottocategoria dall'elenco delle categorie?

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 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

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.

Ciao,

Nella mia situazione ho invocato l’opzione nascosta per annidare 2 sottocategorie sotto una categoria principale e in quella situazione solo l’ultima sottocategoria annidata è nascosta. Esiste un modo, tramite CSS, per nascondere due livelli in profondità?
Ad esempio:
Categoria principale
sottocategoria 1 - nascondi
sottocategoria 2 - nascondi

Il CSS fornito qui nello scenario sopra nasconde solo la sottocategoria 2.

.category .subcategories {
      display: none;
    }

Grazie.

Dovresti ispezionare l’elemento aggiuntivo con gli strumenti per sviluppatori del tuo browser e quindi aggiungere la sua classe alla dichiarazione di stile.

Grazie per la risposta!

Nota: ho attivato la funzionalità nascosta che consente una categoria nidificata aggiuntiva, 3 in totale rispetto a 2.

Ecco un esempio che potrebbe illustrare meglio il problema:
ad es., Pagina principale:
Test (Categoria)

  • Test - Sub 1 (Categoria nidificata della Categoria Test padre)
    In questo scenario,
.category .subcategories {
      display: none;
    }

funziona bene.
image
Come puoi vedere, la categoria nidificata test - sub 1 non viene visualizzata.

Se aggiungo un’altra sottocategoria nidificata:
test - sub 2 category, con sub 1 category come genitore:


come puoi vedere nell’immagine sopra, test - sub 2 è nascosto
in base al codice CSS, ma test - sub 1 non è più nascosto.

Il problema ora è duplice:
Posso nascondere il titolo test - sub 1, impostando la sua classe su display: none, ma nasconde anche tutte le categorie padre nella pagina principale.
Il secondo problema è che, anche se potessi isolare e nascondere solo la categoria nidificata test - sub 1, lo spazio che occupa è ancora lì e sarà problematico, ho bisogno di circa 20 categorie in più nella pagina principale con due sottocategorie nidificate ciascuna.
Idealmente, voglio solo che l’utente finale possa fare clic sulla Categoria Test e avere accesso alle altre Categorie nidificate, ecc., il che si ottiene facilmente, tramite
Mostra l’elenco delle sottocategorie sopra gli argomenti in questa categoria.
e impostando: stili dell’elenco delle sottocategorie su, ad es. caselle, ecc.

Se a un certo punto voglio posizionare un’altra categoria della pagina principale dopo la Categoria Test, non voglio 20 righe di spazio vuoto, ecc.

Pensieri?

Prova questo Theme component

Ha funzionato bene, grazie!