Hugo

Academic's Integrated Search on File System Deployment

Hi everyone. Thank you for reading; this is my first Hugo Forum question.

I’m deploying a Hugo site internally at work, with the Academic theme. Because I could not get a server provisioned for it, I’m running everything from a shared file system. I copy everything from my public folder up to a shared folder, and open it there.

A lot of it has worked!! I set relativeURLS = true, and that helped quite a bit. I’ve also made a few changes to links—for example linking to folder/index.html instead of just folder/.

One thing that I haven’t been able to make work, and I really hope to get working, is integrated search. Most of the content is company-confidential, so I don’t have the liberty to use a third-party engine. When I deploy the site locally on my laptop, search works fine. When I copy the files to the shared location, it just sits there and stares at me. Any pointers on what to try or even what to research to understand it better? Thank you very much for your time.

Ooh, this might be a piece of it. Shoot. I’m still very much learning but am sharing my research as I go.

jquery.min.js:2 Access to XMLHttpRequest at 'file://path/to/index.json'
from origin 'null' has been blocked by CORS policy:
Cross origin requests are only supported for protocol schemes:
http, data, chrome, chrome-extension, https.
call line
send @jquery.min.js:formatted:3879
ajax @jquery.min.js:formatted:3648
k. @jquery.min.js:formatted:3761
getJSON @jquery.min.js:formatted:3750
(anonymous) @academic.min.16bbb37…8.js:formatted:3174

With a bit of research, it looks like querying local files is disabled for file:// because, well, if you allowed that you’d have websites reading your personal files all the time. Sigh.

On line 3175 of the academic.min.etc.js code, I learned that Academic uses Fuse.js, a JavaScript fuzzy-search library with zero dependencies. This is getting well out of my depth, but I did put a call out on Twitter to see if anyone was able to share ideas. I’m adding that link below. Thank you to anyone who arrived here via that thread, and anyone who has read this far.