Don't hard-code category icons, phrases



  • On this page for example:

    https://community.nodebb.org/recent

    The categories show an icon in front of them. These are in the html apparently. Can this be put into the CSS via pseudo-elements to make theming easier? A lot of people may not want to use those icons or may not want icons at all.

    Ditto for the phrase "posted in" which personally I find redundant and don't really want to see many times on a page. I think that should be optional for people and is more of a display thing and can be inserted via pseudo element for whoever wants it. Same goes for "replied" and so on. These phrases are repetitive and may not be necessary for many themes.

    Again this will just make theming a lot easier if stuff like this is in the CSS.

    A class on the category could also make it possible to do color-coding and so on...


  • GNU/Linux Admin

    @art Themes can override templates (in fact, you're encouraged to do so, really), so you are free to remove the icons or the repeated text or anything that you don't like 😄

    I don't think the icons (in /recent) can be done in CSS, because they are not hard-coded. They are pulled from the db, which can change, and in CSS, I have to know the specific FontAwesome character code to put it in.



  • Ok, thanks @julian. Makes sense! And I should be able to use the category slug for a CSS class if I want to style the categories.

    I was just worried about the templates breaking if I upgrade the nodebb version, but I guess it won't touch the theme. And I would just have to copy over any new features into my own template files.


  • Admin

    Yeah, I've seen themes that don't even utilize the category icons. Long time from now - but I am definitely thinking of abstracting out fontawesome category icons to a bundled plugin within lavender and vanilla. Not everybody needs that and I think that we could definitely just get away with having them being set on a separate page in the ACP.


  • Plugin & Theme Dev

    That would make a lot of sense. Some people don't like FontAwesome or use another icon set entirely - making it more modular would allow for more freedom to choose how you wish.


Log in to reply
 

Suggested Topics

| |