Feedback on "on-discourse" javascript for setting up custom JS for each page?

I think you want to put your code in an initializer rather than in a head. Look at the developer guide and see how you can put your JS in separate files.

1 Like