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








