Frontier Software

Modules

Modules

A Hugo module is a go module, so requires the same steps:

mkdir mymod
cd mymod
hugo mod init mymod
go: creating new go.mod: module mymod

hugo mod

Hugo Modules: everything you need to know!

Go Modules

Working with Hugo Module Locally

Tutorial

hugo mod init github.com/gohugoio/myShortcodes

Configuration

{
   "module": {
      "noProxy": "none",
      "noVendor": "",
      "private": "*.*",
      "proxy": "direct",
      "replacements": "",
      "vendorClosest": false,
      "workspace": "off",
      "hugoVersion": {
         "extended": false,
         "max": "",
         "min": ""
      },
      "imports": [
         {
            "disable": false,
            "ignoreConfig": false,
            "ignoreImports": false,
            "path": "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
         },
         {
            "path": "my-shortcodes"
         }
      ],
      "mounts": [
         {
            "source": "content",
            "target": "content"
         },
         {
            "source": "static",
            "target": "static"
         },
         {
            "source": "layouts",
            "target": "layouts"
         },
         {
            "source": "data",
            "target": "data"
         },
         {
            "source": "assets",
            "target": "assets"
         },
         {
            "source": "i18n",
            "target": "i18n"
         },
         {
            "source": "archetypes",
            "target": "archetypes"
         }
      ]
   }
}

path Can be either a valid Go Module module path, e.g. github.com/gohugoio/myShortcodes, or the directory name for the module as stored in your themes folder.

source The source directory of the mount. For the main project, this can be either project-relative or absolute and even a symbolic link. For other modules it must be project-relative.