Kategorie-Banner

:discourse2: Zusammenfassung Category Banners verwendet vorhandene Kategoriedetails, um Banner für Ihre Kategorie-Seiten zu erstellen (für Tags siehe Discourse Tag Banners).
:eyeglasses: Vorschau Vorschau im Discourse Theme Creator
:hammer_and_wrench: Repository-Link https://github.com/discourse/discourse-category-banners
:open_book: Neu bei Discourse Themes? Anfängerleitfaden zur Verwendung von Discourse Themes

Dieses Theme-Komponente installieren

Funktionen

Category Banners verwendet vorhandene Kategoriedetails, um Banner für Ihre Kategorie-Seiten zu erstellen. Es nutzt den Kategoriennamen, die Beschreibung und die Farbe, um ein Banner oben auf den relevanten Kategorie-Seiten zu generieren (für Tags siehe Discourse Tag Banners).

Die Kategorienbeschreibung wird durch den ersten Absatz im Thema „Kategoriedefinition für …" jeder Kategorie definiert. Die Banner-Hintergrund-/Textfarben werden durch Ihre Kategorie-Abzeichen-Einstellungen festgelegt.

Standardmäßig wird dies auf Desktop und Mobile auf allen Kategorie- und Unterkategorie-Seiten angezeigt, erscheint jedoch nicht, wenn Sie Ihrer Kategorie keine Beschreibung gegeben haben.

Einstellungen

Diese Komponente bietet Optionen, um die Standardwerte zu überschreiben:

Name Beschreibung
show description Beschreibung aus dem Beitrag „Über diese Kategorie" anzeigen
show mobile Banner auf Mobile anzeigen
show subcategory Banner für Unterkategorien anzeigen
hide if no description Banner ausblenden, wenn keine Kategorienbeschreibung festgelegt ist
show category logo Kategorie-Logo anzeigen
align text
exceptions Banner wird nicht für diese Kategorie-NAMEN angezeigt
categories Kategorien, für die ein Banner angezeigt werden soll
plugin outlet Ändert die Position des Banners auf der Seite
show category icon Kategorie-Symbol oder Emoji aus den Kategorie-Einstellungen anzeigen *
override category icon color Wenn Kategorie-Symbole verwendet werden, sorgt die Aktivierung dieser Option dafür, dass das Symbol der Banner-Textfarbe entspricht

Hinweise zur Anpassung

Wenn Sie diese mit etwas zusätzlichem CSS anpassen möchten, können Sie spezifische Kategorie-Header mit dieser Struktur ansprechen (example-category ist Ihr Kategorie-Name):

.category-title-header {
  &.category-banner-example-category {
        background: url(example.jpg);
  }
}

Diese Komponente fügt dem Body-Tag zusätzlich die Klasse category-header als CSS-Ziel hinzu.


:discourse2: Von uns gehostet? Theme-Komponenten können in unseren Standard-, Business- und Enterprise-Plänen verwendet werden.

101 „Gefällt mir“
Beginner's guide to using Discourse Themes
How difficult would it be to make the Discourse UI more like Flarum?
Banner on Discourse Forum
Unique CSS class for Group pages?
Category boxes links
Plugins and theme components rarely support tag-pages
Discourse Category Headers theme component
Upcoming Events calendar -- how to embed in post?
New Theme: Tag-Pages Navigation
Tag Banners
Sending a message upon post
Header Submenus
Impact of component positioning with 2.5.0.beta6
Category Description
Capitalizing Tag names in Tag Banners
About Category Auto-Created Topic - Sitewide Options
Subcategories
Discourse as a Conference App (in person, virtual, or hybrid)
Show different ads on different categories
Unique CSS class for Group pages?
Adjusting layout of category pages
Category image not aligning as expected
Add forum description at top of home page
How do I add category banners?
Recommendations on layouts? A way to preview changes?
Category banner image slow to load
Use tag and category banner components together
Category page with fixed organization of topics
Customizing your site with existing theme components
How are these subcategories displayed on meta?
What is it that creates the big heading which is based on the "About the ... category" topic?
Discourse Doc Categories
Theme or Custom CSS on Monday’s Discourse Instance?
I need to install the Category Style plugin for my website
I want to know how to do this?
Add banner to categories
Help us test Horizon, our newest theme
Official groups/posts
Discourse Category Headers theme component
Creating a Unique Gallery Layout for a Category
Official groups/posts
Horizon Theme
New users can't sign up, 404 errors in console
Category, Group, Tag Descriptions as Topics
Uncaught (in promise) error
Category, Group, Tag Descriptions as Topics
Discourse Category Home :house:
Do you know what theme this is?
Traditional multi level hierarchy vs flat discourse hierarchy
How to add a "button" which composes a pre-filled topic
Category color selection should be allowed even when style is "none"
Show customisable message on private topics/categories?
Category description just after name
How to add this header, colored categories, and sidebar categories?
Receive the full description of a category in a theme
How can I create a category wide banner?
How to display a disclaimer to every topic in a category?
Update changed the "category logo" settings and now all the pictures are microscopic. revertable?

thanks for this wonderful theme :heart:, it helps users to note the category description much easier.

currently if there’s a link or a bold/italic word in the category description, in the banner it’ll appear as simple text (e.x. p style instead of a style). isn’t it better if the text style is preserved in the banner as well?

2 „Gefällt mir“

Hi, I absolutely love this component! Thanks for your work!

I’m wondering, how can I style the background so that it automatically pulls the category background image and makes it the background of the banner. The backgrounds are already hidden anyways, so I want it to simply display as the background to the banner, rather than the page. I’ve tried this, but it didn’t work and I think I might be targeting the wrong variable:

return h('div.category-title-header' + " ." + category.slug, {
                    "attributes" : {
                        "style" : "background-color: #" + category.color + "; color: #" + category.text_color + "; background-image: url(\'" + 
                        category.background_url + "\');"
                    }
                }

Also, I’m wondering, how can I make the banner thinner for a fixed width design. When I attempted, it continued to be left-justified.

2 „Gefällt mir“

I think it’s great that the category banners now render the content in HTML

Is there any way to display emoji’s there? In my case I added three important links: Anfänger - Cannabisanbauen.net Forum

I want to display the emojis next to each link as well. The original about topic is here: Über die Kategorie Anfänger - Anfänger - Cannabisanbauen.net Forum

1 „Gefällt mir“

Not prefixing the category name is a recipe for disaster, so I’ve added category-banner- before the class name (e.g., category-banner-meta). If you were targeting the category name in your CSS you’ll just have to add category-banner- before it.

I’m not sure, I don’t think our default category descriptions support them either, but I can look into it…

5 „Gefällt mir“

I want to use the uploaded background image from the category to put it in the background of the banner. I’ve edited the code and everything looks great. I wonder is there anything I can do to make the image load faster or together with the rest of the page? I want to avoid the flickering of the background for a second before the image appears.
Compressing image is certainly an option, but I wonder if there are others. Can I grab the thumbnail of the uploaded background image in the code? Thanks for all leads!

2 „Gefällt mir“

Hello, and thank you for this theme component!

I just tried installing it, following this tutorial (did exactly the same steps) to try this Category Banners component, but nothing happens. No banner in any of the categories. Is there anything that I might have done that doesn’t make it work? The only explanation I see is that the “bootstrap” warning blocks it?

1 „Gefällt mir“

By default, the theme component does not display category banners if you have not set a category description for a category. This can be changed by unchecking the “Hide banners if category description not set” checkbox.

Category descriptions are set by editing the About category topic that Discourse automatically creates for every category. If you have either added category descriptions, or disabled the setting to hide banners for categories without descriptions, and you are still not seeing category banners, let us know. We’ll look into what is going on.

6 „Gefällt mir“

Thank you for your answer. I have checked and confirm that each category on the forum has a description. The “Hide banners…” option is now unchecked just to make sure but nothing changes.

As you can see on the images, everything looks normal in the settings :

No idea if it could have anything to do with the issue but just informing you it’s a Discourse installation on a Yunohost instance.

1 „Gefällt mir“

Is there anyone other than me that thinks it would be nice to enable this same styling on Group listing pages (e.g. /g/foo) as well? The CSS, unfortunately, is not quite the same, and I guess it would require some additional handling of the various buttons to the right side of the group name, i.e., :bust_in_silhouette: Request:email: Message :garbage: Delete

It could go a long way for a consistent look and feel, and make groups feel more like a “first class” citizen among the UI. (IMHO)

5 „Gefällt mir“

I love these category banners! Thank you for making this theme component!

I would love this banner to exist in the main home page of our forums where it shows:

  • “Latest” Discussions or
  • “Top” Discussions or
  • “Categories” or
  • “Following” (if you’re using the Follow Plugin :man:)

Would there be an easy (ish) way to have there be a banner if someone selected each of these options, respective to what was selected?

2 „Gefällt mir“

@awesomerobot, ich hoffe, es ist in Ordnung, wenn ich das hier teile…

Ich habe eine Fork dieses Themas „discourse-category-banners“ erstellt, die

discourse-category-banner-boxes
https://github.com/naidihr/discourse-category-banner-boxes

heißt. Du kannst sie hier in der Vorschau ansehen:

https://theme-creator.discourse.org/theme/Rhidian/discourse-category-banner-boxes

Sie macht im Großen und Ganzen das Gleiche, jedoch mit einigen Anpassungen:

  • Das Kategorie-Banner-Box wird inline über der Hauptüberschrift angezeigt, anstatt in voller Breite oben. Dies ermöglicht die Anzeige eines Banner-Themas oben, beispielsweise des „discourse-versatile-banner“.

  • Das Kategorie-Banner-Box wird im gleichen Stil wie die nativen Discourse-Unterordner-Boxen dargestellt, die ein Kernbestandteil von Discourse sind. Diese Unterordner-Boxen sind eine Anzeigeoption in den Discourse-Kategorieeinstellungen Unterordnerliste über den Themen in dieser Kategorie anzeigen. Diese Option zeigt den Namen und die Beschreibung der Unterordnerkategorie als Zeile oder Box über der Themenliste an, wobei die Hintergrundfarbe der Kategorie als linker Rand verwendet wird.

  • Wenn die Kategorie eine Unterordnerkategorie ist, wird der Kategoriename als Breadcrumb wie folgt angezeigt – Name der übergeordneten Kategorie: Name der Unterordnerkategorie.

Demo-Screenshot des Themen-Banner-Box für die Kategorie, über den nativen Unterordner-Boxen.

Screenshot der Unterordnerkategorie, der die Breadcrumb-Referenz zur übergeordneten Kategorie zeigt.

Dies ist mein erster Versuch einer Themenanpassung. Ich hoffe, das ist hilfreich!

Update

Ich habe diese Anpassung als separate Komponente refaktoriert – mit vielen zusätzlichen Funktionen, darunter die Verwendung des Kategorie-Logo-Bilds und des Hintergrundbilds in der Kopfzeile. Diese neue Komponente ersetzt effektiv den Standard-Header der Discourse-Kategorie, im Gegensatz zu den Kategorie-Bannern, und ist somit eine neue Komponente. Bitte siehe:

11 „Gefällt mir“

Bei uns funktioniert das nicht. Ich habe sowohl den Kategorie-Slug als auch die Kategorie-ID ausprobiert, aber das Banner bleibt hartnäckig bestehen. Funktioniert das bei jemand anderem?

3 „Gefällt mir“

Ich habe es gerade ausprobiert, und es funktioniert bei mir. Es sucht nach der groß-/kleinschreibungsabhängigen Kategorie name. Im Nachhinein war das nicht die beste Implementierung… Ich kann das wahrscheinlich verbessern.

3 „Gefällt mir“

Ah – diese Art ist genau das Richtige für mich! Und du erwähnst „Name

1 „Gefällt mir“

Statt Ausnahmen hinzuzufügen, welche Kategorien ein hochgeladenes Banner nicht anzeigen sollen, können wir nicht einfach festlegen, welche Kategorie welches Banner anzeigen soll?

2 „Gefällt mir“

Das hängt sicher von der jeweiligen Seite und dem Anwendungsfall ab. Mein erster Gedanke war, dass es wahrscheinlicher ist, dass eine Seite eine flächendeckende Implementierung wünscht und Ausnahmen nur in wenigen Fällen auftreten würden.

Wenn Sie ein Banner nur für eine geringe Anzahl von Kategorien implementieren möchten, gibt es möglicherweise eine bessere Theme-Komponente, die weniger allgemein gehalten ist, wie z. B. Versatile Banner, oder Sie können eine der Optionen anpassen, die unter https://meta.discourse.org/t/banner-themes-and-instructions-for-customizing-them/82368 zu finden sind.

4 „Gefällt mir“

Es wäre toll, ein Bild hochladen zu können, um den Text zu ersetzen.

1 „Gefällt mir“

Danke für diese sehr nützliche Komponente!

Wäre es möglich, eine kleine Erweiterung hinzuzufügen?

  • Füge der restricted-Klasse das Element <span.discourse-category-banners> oder <div.category-title-header> hinzu, wenn die Kategorie nicht öffentlich ist, genauso wie beim Kategorie-Abzeichen.

Das wäre nützlich, um das Banner mit zusätzlichem CSS anzupassen und dem Benutzer zu zeigen, dass diese Kategorie besonders ist.

Derzeit ist das zwar machbar, aber kompliziert, das Schloss-Symbol mit CSS auszuwählen und etwas damit zu machen. Da CSS keinen Eltern-Selektor hat, kann ich das Vorhandensein des Schloss-Symbols nicht nutzen, um zu prüfen, ob das Banner angepasst werden soll.

Ich weiß noch nicht genau, wie man Pull Requests erstellt, aber ich würde dies gerne als guten Anlass nutzen, es zu lernen, wenn du meine Änderung unterstützen würdest.

1 „Gefällt mir“

Lässt sich das auf Tag-Seiten funktionsfähig machen? Ich habe das Plugin tag-banners gefunden, aber es bietet keine Möglichkeit, Text oder Links hinzuzufügen.