Search code examples
javascriptthemeshexo

Where do I put the JavaScript files in Hexo?


Where do I put the JavaScript files so I can extend Hexo using its helper function?

 hexo.extend.helper.register('my-hexo-commadnd', myJavascriptFunction);

Solution

  • Create a scripts folder under your themes.

    Imagine you have the following folder structure:

    - My Hexo Theme
      - languages
      - layout
      - source
      - template
      - any other folder
      - scripts
    

    Just add the scripts folder, as shown above. Every JavaScript file is going to be picked up by Hexo.