Category icons component

theme-component

(Penar Musaraj) #1

Repo link:

https://github.com/pmusaraj/discourse-category-icons

Installation instructions: How do I install a Theme or Theme Component?

What this does?

This component allows category badge links to have icons next to the category name. Here is an example of how this would look, with category style set to none:

Here is how this would look with category style set to box:

Configuration is pretty straightforward:

Note that this component also lets you override the category lock icon used to denote private categories.

Issues

  • Does not correctly respect the icon color when using with the bullet category style. In general, though, this shouldn’t be used with the bullet or bar category styles, the UI would be unnecessarily busy.

Add a custom fontawesome icon and color to your tag
(Emre) #3

This component has had an impact on our forum in an artistic way. I like it.

However there is a problem with category names. I created a category with the name of “Doğa Bilimleri”, but later changed its name to “Bilim” and created a sub-category with the name of “Doğa Bilimleri”.

Before:
Before

After:
After

I only assigned an icon for the category of “Doğa Bilimleri”, not for “Bilim”.

doga-bilimleri-flask

But the flask icon has been assigned for both “Bilim” and its sub-category “Doğa Bilimleri”.

Flask-assigned-for-both

I cannot also assign an icon to a category whose name I change if I use the new name of it, yet the old name always works. (I solved this one: This is all about “category slug”. If you leave the category slug with the old name, you will experience same pseudo-problem.)

Edit: I figured out why the flask icon is assigned for the main category. It is because both the main category and the sub-category include same word “Bilim”. Even if I give a random name like “abcdefbilimghjk” in the category icon list, it will still assign the icon I choose to the category “Bilim”, since the random name includes the word “bilim”.

abcdefbilimghjk


(Penar Musaraj) #4

Hi Emre, thanks for the report, I’ve now fixed the issue with loose matching of slugs. If you update the theme, it should be resolved, “abcdefbilimghjk” will no longer apply the icon to the “bilim” slug.


(Emre) #5

It’s been perfectly resolved. Thanks for the update :+1:


(📹Scammer Revolts💻) #6

This is an awesome component! Works great on my site! ty for doing this :smiley:!awe