Jekyll: different pages js file conflict

less than 1 minute read

I add a new word cloud on categroies page by using wordcloud2, but it shows errors in my tags apge, because I set all js files as document.load , it running js file when web is loaded and * getElementbyId* will return null error.

Solution:

In _include/ scripts.html, add

script

These code can add Javascript depends on which layout are visited by user currently.