When I was developing a Hugo theme Hugo Eureka, I used hugo new -k homepage homepage for users to create a folder homepage under content with a basic index.md file.
And I found that hugo new -k homepage homepage only works when I import theme by using git submodules. But this can not work when imported by Hugo Modules though the output shows:
<my-path>\content\homepage created
Maybe it is a bug right now? I tested it with Hugo 0.82.0
hugo new does not create a page bundle. You have to manually say hugo new homepage/index.md to create a page bundle. It would be nice to somehow set a parameter in the archetype that tells Hugo to always create a page bundle, but that is not available (yet?).
Thanks! But according to Hugo’s Docs, I think this is possible. And this can also be done when importing theme using git submodules or directly. This does not work only in Hugo Modules as far as what I tested
I totally forgot about that. In that case maybe the archetype is not found. I would suspect mounting to be the issue. Try mounting the archetypes/homepage module directory directly to archetype/homepage. I don’t see a config.toml in your theme. So maybe Hugo does not treat it as a module yet.
I think I am not understanding or misunderstanding completely. The repo you linked: Is it a Hugo module? If so, I don’t think you can use the subfolder configuration. It is also not marked as a module. For that it needs a go.mod and (optional) a go.sum. So maybe the whole terminology of a module is where your expectations crash with the realities?
is not a hugo module. For that it needs to be initiated.
Yes, that is a module. And when I tested this, I inited Hugo Modules. Everything works well except this.
Acutally I also build my own site uses Hugo Modules, it works well also. So I don’t think it is because of the misuse of Hugo Module. I think Hugo already treated as a module.
It will. But it won’t be a module. It will be a theme. Either that or THAT is the issue, somewhere it is thought to be a “module”. It’s definitely not a Go module. You create one by running hugo mod init in the theme, then adding the go.mod to the theme. Then adding the theme via modules.toml in your config directory, then adding a config.toml to your theme defining mounts. Only THEN it’s a module (in sense of Go modules) and only then archetypes get folded or mounted into the local archetypes folder. If you use it as a theme, then Hugo ignores the archetypes folder in your theme and assumes it was copied over with sampleSite.
I guess that differentiation of adding it via theme="github path" or [[module]] is the reason for the behaviour. As far as I understand your way of adding it is not an “official” go module way and Hugo probably doesn’t even think about checking for anything to merge.
Let’s wait for some of the developers to have a look at this.