هذه طريقة سهلة لتغيير أيقونة في Discourse على مستوى الموقع بالكامل.
-
انقر بزر الماوس الأيمن على الأيقونة التي تريد تغييرها واختر “فحص العنصر” أو “فحص” (يعتمد على المتصفح)
-
ابحث عن اسم الأيقونة
-
ابحث عن أيقونة جديدة هنا 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”.
إذا كانت الأيقونة مستخدمة لعناصر متعددة في صفحات أخرى، مثل الشارات، فسيتم استبدالها هناك أيضًا.
الاستثناءات
ملاحظة أنه يوجد بالفعل مكوّن موضوع (theme component) يتيح لك تغيير أيقونة الإعجاب. أستخدم هذه الحالة كمثال
أيقونة “القلب”، المستخدمة للإعجاب، مبرمجة مسبقًا بأسماء أخرى ('d-liked' و 'd-unliked') ويجب معالجتها بشكل مختلف عن الأيقونات الأخرى، لذا لتغيير أيقونة
بأيقونة
:
api.replaceIcon("d-liked", "thumbs-up");
api.replaceIcon("d-unliked", "thumbs-o-up");
![]()
![]()
لكن في صفحة الشارات، لا تزال الأيقونة “قلبًا”:
لذا لتغييرها في تلك الصفحة نضيف:
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 components) أخرى ومشاركتها في قسمنا Customization > Theme component!
هذا المستند يخضع للتحكم بالإصدارات - اقترح التغييرات على github.








