Custom CSS/JS for a post/category/tag


(Lxsameer) #1

Hey guys,
I have a large js file which I only need to load for certain posts. Can I do it conditionally ? for example if the post tagged with tag something then the <script> tag get inserted to the page.


(Joe Buhlig) #2

You might be able to do this with a theme customization. You could reopen the TopicModel and give it some criteria based on the topic metadata that tells Discourse when to load the script. Keep in mind that you would likely want to remove the script in the inverse situation as well.