So kannst du ein Discourse-Symbol global ändern.
-
Klicke mit der rechten Maustaste auf das Symbol, das du ändern möchtest, und wähle „Element untersuchen“ oder „Untersuchen“ (abhängig vom Browser).
-
Finde den Namen des Symbols.
-
Suche dir ein neues Symbol hier: Find Icons with the Perfect Look & Feel | Font Awesome, z. B. external-link-alt
-
Passe den Code an und füge ihn in deinem Tab
admin > customize > themes > edit code -> JSein.
// {theme}/javascripts/discourse/api-initializers/init-theme.gjs
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
api.replaceIcon("link", "external-link-tab");
});
- Symbole, die von Discourse standardmäßig nicht verwendet werden, müssen in der Seiteneinstellung
svg icon subsethinzugefügt werden. Danach den Browser mit erzwungenem Neuladen aktualisieren, um die Änderungen zu sehen.
Ergebnis:

Alle „link“-Symbole werden durch „external-link-tab“ ersetzt.
Wenn ein Symbol für mehrere Elemente auf anderen Seiten verwendet wird, wie z. B. Abzeichen, wird das Symbol auch dort ersetzt.
Ausnahmen
Hinweis: Es gibt bereits ein Theme-Component, mit dem du das Like-Symbol ändern kannst. Ich verwende diesen Fall als Beispiel.
Das „heart“-Symbol, das zum Liken verwendet wird, ist mit anderen Namen ('d-liked' und 'd-unliked') hartkodiert und sollte anders behandelt werden als andere Symbole. Um das
-Symbol durch das
-Symbol zu ersetzen:
api.replaceIcon("d-liked", "thumbs-up");
api.replaceIcon("d-unliked", "thumbs-o-up");
![]()
![]()
auf der Abzeichen-Seite ist das Symbol jedoch immer noch „heart“:
um es auf dieser Seite zu ändern, fügen wir hinzu:
api.replaceIcon("heart", "thumbs-up");
Ein weiteres Beispiel:
api.replaceIcon("d-watching", "eye");
ändert das Watching-Symbol:
Siehe hier weitere Ausnahmen, die den Tracking-Status, Aufklappen/Einklappen, Benachrichtigungen und natürlich Likes abdecken.
const REPLACEMENTS = {
"d-tracking": "bell",
"d-muted": "discourse-bell-slash",
"d-regular": "far-bell",
"d-watching": "discourse-bell-exclamation",
"d-watching-first": "discourse-bell-one",
"d-drop-expanded": "caret-down",
"d-drop-collapsed": "caret-right",
"d-unliked": "far-heart",
"d-liked": "heart",
"d-post-share": "link",
"d-topic-share": "link",
"notification.mentioned": "at",
"notification.group_mentioned": "users",
"notification.quoted": "quote-right",
"notification.replied": "reply",
"notification.posted": "reply",
"notification.edited": "pencil-alt",
"notification.bookmark_reminder": "discourse-bookmark-clock",
"notification.liked": "heart",
"notification.liked_2": "heart",
"notification.liked_many": "heart",
"notification.liked_consolidated": "heart",
"notification.private_message": "far-envelope",
"notification.invited_to_private_message": "far-envelope",
"notification.invited_to_topic": "hand-point-right",
"notification.invitee_accepted": "user",
"notification.moved_post": "sign-out-alt",
"notification.linked": "link",
"notification.granted_badge": "certificate",
"notification.topic_reminder": "far-clock",
"notification.watching_first_post": "discourse-bell-one",
"notification.group_message_summary": "users",
"notification.post_approved": "check",
"notification.membership_request_accepted": "user-plus",
"notification.membership_request_consolidated": "users",
"notification.reaction": "bell",
"notification.votes_released": "plus",
"notification.chat_quoted": "quote-right",
};
Ref: discourse/icon-library.js at main · discourse/discourse (github.com)
Erstelle gerne weitere Theme-Components und teile sie in unserer Kategorie Customization > Theme component!
Dieses Dokument wird versioniert – Vorschläge für Änderungen auf github.








