Hugo Modules notes

Notes concerning Hugo Modules.

If I kept a git repo where the root directory had the content, the way to mount it would be:

    - path: ""
      disabled: false
      - source: "."
        target: "content/maiki"

I probably wouldn’t do that, of course, since bunches of other files would then get caught up in the content path (versioning stuff, LICENSE, README, etc.).

A Hugo project has to be set as a module for it to work. That means running hugo mod init on a repo. It requires a project name, folks use their repo URLs sans protocol a lot.

I can’t ever recall if go.mod and go.sum should be committed or not…

I think I’d commit go.mod if I want the project to be ready to go. Since any project I build will require go to be installed to use Hugo modules, it makes sense to do so. go.sum is made on the fly at build time, so I think I can leave it out.


Or I can just remember to run hugo mod init $whatever each time the project is run on a new directory. That works too.