Link to local js file in .md document

I am using the Academic theme and I try to include a js library in my file to display some 3d images. When I use the below code in the file it works fine:

<head><script src=""></script> </head>    
         <div style="height: 400px; width: 400px; position: relative;" class='viewer_3Dmoljs' data-pdb='2POR' data-backgroundcolor='0xffffff' data-style='stick'></div>

I copied the js library in the static/js folder and named it 3Dmol-min.js. When I change the code to

<head><script src="3Dmol-min.js"></script></head>

Nothing happens. What is the correct way to reference to the local js library in the static folder?

I checked: but it does not describe the way to do it for js files.

Try <script src="/js/3Dmol-min.js">

When hugo builds your site, everything in the /static folder gets copied directly to the build folder (e.g. public). So a file names /static/js/3Dmol-min.js becomes /public/js/3Dmol-min.js…and your webserver will serve it out (normally) as

1 Like

It worked! Thank you!