Condition for only rendering code on pages and threads

Is there a way to setup a condition in a template so that a snippet of code will only be displayed on all threads and pages, but not in forum indexes or add-ons (like xenporta)?

I use Viglink to monetize some links, but for speed purposes, I'd like it if I didn't load these .js files on the homepage (xenporta) and the forum indexes.