Hosting a Hugo site on a Cloudflare Worker

Following a discussion on hosting Hugo on a Cloudflare worker, @jmooring came up with an excellent solution.

Here’s an example project hosted on a Cloudflare Worker:

This is the build script:

And the wrangler.toml file

Those are the only two files you need to copy to your project and configure to your liking. For example–

  • change Dart SASS version or if you don’t transpile SASS to CSS, you can remove Dart SASS code from the build.sh file.
  • change the time zone.
  • change Hugo version