Category Hider Theme-Komponente

Hi all, I’ve created a simple theme component. I hope this could be of use for some!

:eyeglasses: Overview

This is a theme component that allows you to hide specific categories from either the hamburger menu or category boxes.

:thinking: Why would you need this component?

If your discourse website has a lot of categories and you would like to hide some from appearing in either the menu bar or on the main page, this component can be helpful.

:framed_picture: Screenshots

Preview of Hamburger Menu: Before → After

:gear: Settings Menu:

More details on how to use this theme component and installation instructions are available at the component’s GitHub repository.

14 „Gefällt mir“

This looks pretty cool, but what advantage does it give you over muting a category?

5 „Gefällt mir“

Correct me if I’m wrong, but from what I understand is that when I mute a category it basically means no notifications? :thinking: When I tried muting a category it still appears in the hamburger menu and category boxes.

This theme component is more of a stylistic change. It hides desired categories visually, but still keeps notifications and all other functionality for the category intact.

2 „Gefällt mir“

This only occurs (I think) if the user has a topic in one of those categories that is unmuted.

Your component would prevent that occurring, which could be helpful in situations where you really want to suppress the category and keep things tidy.

4 „Gefällt mir“

Hey keegan,

this component looks exactly like something we need in the future. Our use case is very specific in which we want to hide sub-categories from one specific parent category.

In combination with the code snippet from here this might achieve exactly what we are looking for:

2 „Gefällt mir“

Hi this seems to be broken after latest discourse update.

1 „Gefällt mir“

@Heliosurge Thanks for letting me know, will fix this as soon as I can and will post an update here.

2 „Gefällt mir“

Hey @Heliosurge,

The issues with the theme component are now fixed. It should be working correctly now.

3 „Gefällt mir“

Thank you Keegan. An interesting idea as had posted a help topic as had used css prior to accomplish this.

One member @manuel had given me a great piece of css as I was using this to hide many subcategories so only Parents show in hamburger.

So as a Though maybe adding a toggle to hide just subcategories.

.hamburger-panel .category-link.subcategory {
      display:none;
}

This setting can make things very convenient if ppl have alot of subs to hide.

4 „Gefällt mir“

@Heliosurge

Sounds very convenient! Thanks! I’ve added that now to this theme component, so you can now toggle the ability to hide subcategories in the hamburger menu and/or category-list context.

3 „Gefällt mir“

Awesome! Thank you keep up the fantastic work.

:beers::sunglasses::+1::sparkles:

1 „Gefällt mir“


Hallo @keegan
Können wir die Kategorie im Top-Menü ausblenden?
Danke!

Ich erhalte beim Installieren (auf 3.1.0beta3) die folgende Fehlermeldung:

Fehler: „]“ erwartet. ┌──> /tmp/discourse_theme_526e702e5adb76bf8137c869c5f6d389/discourse-category-hider/stylesheets/mobile/categories.scss 6 │ [data-category-id=‘#{$box}’] { │ ^^^^ ╵ ╷ 1 │ [data-category-id="str-split(, "|")] │ ━ Fehler in interpolierter Ausgabe ╵ mobile/categories.scss 6:26 @import /var/www/discourse/mobile.scss 1:993 root stylesheet

2 „Gefällt mir“

Ja, das wäre nützlich, außer dass die Installation für die neueste Discourse-Version jetzt kaputt ist.

Ich habe gerade eine Korrektur veröffentlicht. Bitte versuchen Sie die Installation erneut/aktualisieren Sie die Komponente.

Ich habe diese Funktion gerade hinzugefügt. Sie können jetzt den Kategorienamen zur Theme-Einstellung category_breadcrumb hinzufügen, um bestimmte Kategorien aus der Dropdown-Liste der Kategorie-Breadcrumbs auszublenden.

5 „Gefällt mir“

Entschuldigen Sie, aber keine Wirkung


Habe ich Recht?

1 „Gefällt mir“

Stellen Sie sicher, dass Sie den Namen der Kategorie und nicht den Slug der Kategorie verwenden.

3 „Gefällt mir“

Danke,
Erfolg,
Jeder, beachte Groß- oder Kleinschreibung

4 „Gefällt mir“

Hallo

Diese Komponente funktioniert gut im Standard-Kategoriebildschirm und im Breadcrumb, jedoch:

Sie entfernt die Kategorien nicht aus dem Hamburger-Menü, es sei denn, die Seitenleiste ist auf Legacy eingestellt.

Gibt es eine Möglichkeit, die Kategorien in der Standard-Seitenleiste/im Hamburger auszublenden?

Ich habe die Einstellung „Kategorie-Hamburger“ ausprobiert, konnte sie aber anscheinend nicht zum Laufen bringen.

Danke

2 „Gefällt mir“

Hallo @martyn_thomas

Sie können die Kategorien im Navigationsmenü mit den Admin-Einstellungen festlegen – default_navigation_menu_categories – diese Einstellung ermöglicht es Ihnen auszuwählen, welche Kategorien standardmäßig im Abschnitt „Kategorien“ des Navigationsmenüs angezeigt werden. Benutzer können dies überschreiben und ihren eigenen Kategorienmenübereich anpassen, indem sie auf das Bleistiftsymbol neben der Überschrift „Kategorien“ klicken, genau wie Sie es können, und dies sollte generell gefördert werden.

2 „Gefällt mir“