Serve assets (like jquery) from own server


I’m starting to use Hugo, using the ‘Academic’ theme (though that’s probably more than just a theme…)

That theme makes heavy use of several CSS and JS assets hosted at various places, mostly cloudflare. The assets are all registered in the themes ‘data/assets.toml’ file. I wonder if it is possible to tell hugo to download all these assets when building my page, putting them somewhere under ‘public/assets/whatever’ and adapt the links in the template to use these self-hosted variants. Is that possible?

Thanks a lot, Lukas

As you’ve hinted, the Academic theme is massive and powerful. Overriding various features is quite the feat. However, it looks like they’ve built in a way to use self-hosted assets

I’m not exactly sure how it works, but I think if you put your assets in /static/css and /static/js it will use those assets rather than others on the CDN.

Oh okay - so this is something the template does, not Hugo itself. I’ll try to ask the Academic folks how this works. Thanks!

Generally speaking, you can serve any assets you don’t want hugo to process in /static. E.g:

/static/css/somefile.css served as...

See , as mentioned in the readme and documentation.

1 Like

Oh, that indeed looks like what I was searching for. Thank you!