Go/Hugo with modules 404'ing for no reason

Hi,

I’m really about to lose my mind here…

I have a really simple Hugo/Go site that I’m trying to deploy to Cloudflare Pages, yet, no matter what I try, the site is not accessible and throws 404 on all associated domains.

When I run the build locally, there is no issue whatsoever. The build succeeds, the files are in public/, everything works properly.

Then, pushing to Cloudflare Pages, the build logs fills up with errors like this:

Found no layout for "home", language "en", output format "HTML": create a template below /layouts with one of these filenames: index.en.html.html, home.en.html.html, {.....}

Which seems to indicate that the theme is not loaded, but I find that a little bit surprising considering the theme is loaded to current recommendation as a hugo module (not a git submodule), the theme is added to go.mod and as such shouldn’t the “hugo” build command also pull these?

If not, how can I make the build process pull the module?

Thanks

To add to this, I have also tried adding the theme in config.toml like so:

theme = ["github.com/lxndrblz/anatole"]

Which simply results in the build failing again with this message:

Error: Unable to find theme Directory: /opt/buildhome/repo/themes/github.com/lxndrblz/anatole

The module is added to go.mod, and configured in config.toml like this:

[module]
  [[module.imports]]
    path = "github.com/lxndrblz/anatole"
    disable = false

Are you able to link the repo that you are building from?

Hi, are you setting HUGO_VERSION variable?

By default, Hugo v0.54.0 is installed at Cloudflare pages and it does not surport hugo mod.
How to set environment variables is described in ’ Deploy a Hugo site’ pages at Cloudflare official site. (Sorry, I cannot link it for limitation of this site. Please search.)

I hope my reply will help people in need.