هذه طريقة سهلة لتغيير أيقونة Discourse بشكل عام.
-
انقر بزر الماوس الأيمن على الأيقونة التي تريد تغييرها وحدد “Inspect element” أو “Inspect” (يعتمد ذلك على المتصفح)
-
ابحث عن اسم الأيقونة
-
ابحث عن أيقونة جديدة هنا Find Icons with the Perfect Look & Feel | Font Awesome، على سبيل المثال external-link-alt
-
قم بتخصيص الكود وأضفه في علامة التبويب
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");
});
- يجب إضافة الأيقونات التي لا يستخدمها Discourse افتراضيًا في إعداد الموقع
svg icon subset، ثم قم بإعادة تحديث متصفحك بالقوة لرؤية التغييرات المطبقة.
النتيجة:

سيتم استبدال جميع أيقونات “link” بأيقونة “external-link-tab”.
إذا كانت الأيقونة مستخدمة لعناصر متعددة في صفحات أخرى، مثل الأوسمة (badges)، فسيتم استبدالها هناك أيضًا.
استثناءات
ملاحظة: يوجد بالفعل مكوّن سمة (theme component) يسمح لك بـ تغيير أيقونة الإعجاب. أنا أستخدم هذه الحالة كمثال
تكون أيقونة “heart”، المستخدمة للإعجاب (Like)، مكتوبة بشكل ثابت (hardcoded) بأسماء أخرى ('d-liked' و 'd-unliked') ويجب معالجتها بشكل مختلف عن الأيقونات الأخرى، لذا لتغيير أيقونة
إلى أيقونة ![]()
api.replaceIcon("d-liked", "thumbs-up");
api.replaceIcon("d-unliked", "thumbs-o-up");
![]()
![]()
لكن في صفحة الأوسمة، تبقى الأيقونة “heart”:
لذلك لتغييرها في تلك الصفحة، نضيف:
api.replaceIcon("heart", "thumbs-up");
مثال آخر:
api.replaceIcon("d-watching", "eye");
يقوم بتغيير أيقونة المتابعة (watching):
انظر هنا إلى استثناءات أخرى تغطي حالة التتبع، توسيع/طي القائمة، الإشعارات، والإعجابات بالتأكيد.
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",
};
المرجع: discourse/icon-library.ts at main · discourse/discourse (github.com)
لا تتردد في إنشاء مكوّنات سمات أخرى ومشاركتها في فئتنا Theme component!
هذا المستند مسيطر عليه بالإصدارات - اقترح التغييرات على GitHub.








