How can i add a class to the body ?

  • Hi !

    I'm currently trying to make a PR to implement a feature, i've created a field bodyClass into the Category settings and now i don't find how i can inject it into the body class when i'm into the topic list and reading a topic.

    I've found that buildBodyClass is related to the URL, but i don't find how to use my custom attribute 😕

    There is any documentation about the source code?

  • NodeBB Admin

    You can use, or filter:middleware.render and modify bodyClass keep in mind the topic page already has a body class that also contains the category, so for example this page has this class. skin-noskin page-topic page-topic-11761 page-topic-how-can-i-add-a-class-to-the-body page-topic-category-3 page-topic-category-nodebb-development

  • Oh! I haven't noticed this change, this is awesome 👍

Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.