Hugo Module imported mount appears as 'null'

Hi everyone,

As part of our open source project, we’re currently working on moving some of the code in our repository to their own dedicated repository. That also means that our documentation is impacted, since all this is currently all in one repository and we want to move the relevant pieces of documentation also to that dedicated repository.

That being said, we currently have all our documentation hosted in one repository. You can find this at flink/docs at master · apache/flink · GitHub.

I’m currently doing an experiment to move out 4 documentation files from this repo to its own repository. You can find this at GitHub - MartijnVisser/flink-connector-elasticsearch at copy-docs-experiment. Those files are:

  1. content/docs/connectors/datastream/
  2. content/docs/connectors/table/
  3. content.zh/docs/connectors/datastream/
  4. content.zh/docs/connectors/table/

However, we still want to be able able to build all documentation as it was generated in one repository. I think Hugo Modules would be the best way to go, but I’m running into an issue where the mount returns ‘null’ as value instead of a proper result.

So what I’ve done is the following:

  1. Configure the main repo as a module by running hugo mod init
  2. Added a module by running hugo mod get -u (since this is on a specific branch)
  3. I’ve expanded our config.toml with:
  path = ''
  source = 'content'
  target = 'content'
  1. However, when I now run hugo config mounts, this is what’s being reported:
   "path": "",
   "version": "v0.0.0-20220421085604-595f9464c12a",
   "time": "2022-04-21T08:56:04Z",
   "owner": "",
   "dir": "/var/folders/vy/p3hq5hts1wlbs4ycpxj82p5r0000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/!martijn!visser/flink-connector-elasticsearch@v0.0.0-20220421085604-595f9464c12a/",
   "mounts": null

As you can see, the mounts is reported as null. I’m suspecting that’s why I haven’t been able yet to get the Hugo Module properly working. What am I doing wrong?

I’m running hugo v0.97.3+extended darwin/amd64 BuildDate=unknown

Thanks in advance for the help.

Best regards, Martijn

I think your problem is the import path. I think it should be:

path = ''

And then add a go.mod file in the docs directory with:


go <version of go you're using> 

Try that and see if it gets you anywhere.

1 Like

@IanMadd is right, if you want to split a repo into multiple submodules, each sub folder (module) need its own go.mod file.

You can avoid creating go.mod files by just using the root:

  path = ''
source = 'docs/content'
target = 'content'


Thanks to the help of you both I’ve been able to fix it. Many thanks again for your support.