Este é um jeito fácil de alterar um ícone do Discourse globalmente.
-
Clique com o botão direito no ícone que você deseja alterar e selecione “Inspecionar elemento” ou “Inspecionar” (depende do navegador)
-
Encontre o nome do ícone

-
Procure um novo ícone aqui https://fontawesome.com/icons?d=gallery, por exemplo external-link-alt
-
Personalize e adicione o código na aba
admin > customize > themes > edit code -> JS
// {theme}/javascripts/discourse/api-initializers/init-theme.gjs
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
api.replaceIcon("link", "external-link-tab");
});
- Ícones que não são usados por padrão pelo Discourse devem ser adicionados na configuração do site
svg icon subsete então force o recarregamento do seu navegador para ver as alterações aplicadas.
Resultado:

Todos os ícones de “link” serão substituídos por “external-link-tab”.
Se um ícone for usado para múltiplos elementos em outras páginas, como emblemas (badges), o ícone também será substituído lá.
Exceções
Note que já existe um componente de tema que permite alterar o ícone de Curtir. Estou usando este caso como exemplo.
O ícone de “coração”, usado para dar Like, é codificado com outros nomes ('d-liked' e 'd-unliked') e deve ser tratado de forma diferente de outros ícones, então para alterar o ícone
pelo ícone
:
api.replaceIcon("d-liked", "thumbs-up");
api.replaceIcon("d-unliked", "thumbs-o-up");
![]()
![]()
mas na página de emblemas o ícone ainda é “heart”:

então para alterá-lo nessa página adicionamos:
api.replaceIcon("heart", "thumbs-up");

Outro exemplo:
api.replaceIcon("d-watching", "eye");
altera o ícone de watching:

Veja aqui outras exceções que cobrem o status de rastreamento, expandir/recolher, notificações e curtidas, é claro.
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)
Sinta-se à vontade para criar outros componentes de tema e compartilhá-los em nossa categoria Theme component!
Este documento é controlado por versão - sugira alterações no github.



, meanwhile I’ve tried several other icons, e.g. 