Noob: Hugo Module not found

ARgh I’m tearing my hair out, I 'm sure it is something very, very simple, but I’m so new to Go and Hugo.

I’ve followed the guides for installing Hugo modules (the git submodules for themes works great!):

Here is my hugo.yaml:

baseURL: https://tongfamily.com
languageCode: en-us
title: My New Hugo Site
theme: hugo-universal-theme
module:
  imports:
    - path: github.com/devcows/hugo-universal-theme

Then I do a hugo mod get -u and I see go.mod is now:

module github.com/richtong/web-hugo

go 1.23.2

require github.com/devcows/hugo-universal-theme v0.0.0-20241011155955-cfc9f1cb7741 // indirect

But when I try to build with hugo or hugo mod graph

Total in 463 ms
Error: failed to load modules: module "hugo-universal-theme" not found in "/Users/rich/wsn/git/src/user/rich/web/web-hugo/themes/hugo-universal-theme"; either add it as a Hugo Module or store it in "/Users/rich/wsn/git/src/user/rich/web/web-hugo/themes".: module does not exist

If I put a git submodule into the themes location it all works fine

Here is my configuration from go version and hugo env

go version go1.23.2 darwin/arm64

hugo v0.135.0+extended darwin/arm64 BuildDate=2024-09-27T13:17:08Z VendorInfo=brew

If you use a module as a theme, don’t set the theme parameter in your config.

The module import is enough.

The theme parameter is for themes physically existing on the file sytem in your themes folder

Wow that was quick. I just found Theme as Module cannot be found and that answered it so confusing as I thought one set the other.

But with module import, then each theme is implicitly added. Thanks so much!!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.