يستخدم Category Banners تفاصيل التصنيفات الموجودة لإنشاء لافتات لصفحات التصنيفات الخاصة بك. يستخدم اسم التصنيف ووصفه ولونه لتوليد لافتة في أعلى صفحات التصنيف ذات الصلة (بالنسبة للوسوم، راجع Discourse Tag Banners).
يُعرّف وصف التصنيف بواسطة الفقرة الأولى في موضوع “تعريف التصنيف لـ…” الخاص بكل تصنيف. تُحدَّد ألوان خلفية/نص اللافتة من خلال إعدادات شارة التصنيف الخاصة بك.
إذا كنت ترغب في تخصيص هذه اللافتات باستخدام بعض CSS إضافي، يمكنك استهداف رؤوس تصنيفات محددة باستخدام هذا الهيكل (مثال: example-category هو اسم تصنيفك):
thanks for this wonderful theme , it helps users to note the category description much easier.
currently if there’s a link or a bold/italic word in the category description, in the banner it’ll appear as simple text (e.x. p style instead of a style). isn’t it better if the text style is preserved in the banner as well?
Hi, I absolutely love this component! Thanks for your work!
I’m wondering, how can I style the background so that it automatically pulls the category background image and makes it the background of the banner. The backgrounds are already hidden anyways, so I want it to simply display as the background to the banner, rather than the page. I’ve tried this, but it didn’t work and I think I might be targeting the wrong variable:
Not prefixing the category name is a recipe for disaster, so I’ve added category-banner- before the class name (e.g., category-banner-meta). If you were targeting the category name in your CSS you’ll just have to add category-banner- before it.
I’m not sure, I don’t think our default category descriptions support them either, but I can look into it…
I want to use the uploaded background image from the category to put it in the background of the banner. I’ve edited the code and everything looks great. I wonder is there anything I can do to make the image load faster or together with the rest of the page? I want to avoid the flickering of the background for a second before the image appears.
Compressing image is certainly an option, but I wonder if there are others. Can I grab the thumbnail of the uploaded background image in the code? Thanks for all leads!
I just tried installing it, following this tutorial (did exactly the same steps) to try this Category Banners component, but nothing happens. No banner in any of the categories. Is there anything that I might have done that doesn’t make it work? The only explanation I see is that the “bootstrap” warning blocks it?
By default, the theme component does not display category banners if you have not set a category description for a category. This can be changed by unchecking the “Hide banners if category description not set” checkbox.
Category descriptions are set by editing the About category topic that Discourse automatically creates for every category. If you have either added category descriptions, or disabled the setting to hide banners for categories without descriptions, and you are still not seeing category banners, let us know. We’ll look into what is going on.
Thank you for your answer. I have checked and confirm that each category on the forum has a description. The “Hide banners…” option is now unchecked just to make sure but nothing changes.
As you can see on the images, everything looks normal in the settings :
Is there anyone other than me that thinks it would be nice to enable this same styling on Group listing pages (e.g. /g/foo) as well? The CSS, unfortunately, is not quite the same, and I guess it would require some additional handling of the various buttons to the right side of the group name, i.e., Request Message Delete
It could go a long way for a consistent look and feel, and make groups feel more like a “first class” citizen among the UI. (IMHO)
يُعرض صندوق شريط التصنيف مدمجًا فوق العنوان الرئيسي بدلاً من عرضه بعرض كامل في الأعلى. وهذا يسمح بعرض موضوع شريط في الأعلى، على سبيل المثال discourse-versatile-banner.
يُعرض صندوق شريط التصنيف بنفس أسلوب صناديق التصنيفات الفرعية الأصلية في discourse، وهي مكون أساسي في discourse. تُعد هذه الصناديق خيار عرض في إعدادات التصنيف في discourse إظهار قائمة التصنيفات الفرعية فوق المواضيع في هذا التصنيف. يعرض هذا الخيار اسم التصنيف الفرعي ووصفه كصف أو صندوق فوق قائمة المواضيع، باستخدام لون خلفية التصنيف كحد أيسر.
إذا كان التصنيف تصنيفًا فرعيًا، فسيتم عرض اسم التصنيف كخريطة تنقل على النحو التالي - اسم التصنيف الأب: اسم التصنيف الفرعي
هذه هي محاولتي الأولى في تعديل موضوع. آمل أن يكون هذا مفيدًا؟
تحديث
لقد أعيدت هيكلة هذا التعديل كمكون منفصل - مع العديد من الميزات الإضافية بما في ذلك استخدام صورة شعار التصنيف وصورة الخلفية في الرأس. هذا المكون الجديد يحل فعليًا محل رأس التصنيف القياسي في Discourse، على عكس أشرطة التصنيف، مما يجعله مكونًا جديدًا. يرجى الاطلاع على:
يعتمد ذلك على الموقع المحدد وحالة الاستخدام، وأنا متأكد من ذلك. كانت فكرتي الأولية هي أنه من المرجح أن يريد الموقع تطبيقه في كل مكان، وإذا كانت هناك استثناءات فستكون قليلة فقط.
أضف فئة restricted إلى عنصر <span.discourse-category-banners> أو <div.category-title-header> عندما لا تكون الفئة عامة، تمامًا كما هو الحال مع شارة الفئة.
سيكون ذلك مفيدًا لتعديل الشريط باستخدام CSS إضافي لإظهار للمستخدم أن هذه الفئة خاصة.
حاليًا، يمكن ذلك لكنه معقد عند اختيار أيقونة القفل باستخدام CSS وإجراء بعض التعديلات، ولكن نظرًا لأن CSS لا يحتوي على محدد للوالد، لا يمكنني استخدام وجود أيقونة القفل للتحقق مما إذا كان يجب تعديل الشريط.
لا أعرف حقًا كيفية تقديم طلبات السحب (PRs) بعد، لكن سأستخدم هذا كسبب جيد لتعلم ذلك إذا كنت مستعدًا لتعديلاتي.