examples to play with at the end of the post
if you cannot get it to work, please share yours real setup and layout incl the module
will save both of us some time
From your description I get would check these:
-
your site has to be a go module, too git mod init
-
using module import usually means importing from outside your repo.
I never tried to import a module that is already physically located in site/themes
but if this works, I think it will fail the next step with your setup
-
your ls of the module shows no files !!
in general a module is not allowed to access files from outside on your project
that’s why I placed the readme physically in the module.
with your original setup your original setup would look like:
module:
imports:
- path: /tmp/semconv # <- notice this is an external module some where outside your repo
mounts:
- source: content/en
target: content
to setup the extra module do (I assume the /tmp/semconv/docs folders cointain much more files) so I keep the single file mounts
-
cd /tmp/semconv/docs
hugo mod init extra
/tmp/semconv/docs/hugo.yamlmodule:
mounts:
- source: app/README.md
target: content/docs/specs/semconv/app/_index.md
- source: azure/README.md
target: content/docs/specs/semconv/azure/_index.md
Take these for a spin
I pushed two branches for you to play with
git clone --single-branch -b topic-56187-mount-module https://github.com/irkode/hugo-forum.git using-module
git clone --single-branch -b topic-56187-mount-config https://github.com/irkode/hugo-forum.git using-config
They require a folder c:/_my_module/ in your filesystem with this content:
- the file imported :
README_ONE.md
- the module version additionally
go mod init
- my
hugo.yaml as shown
logfiles
PS C:\_repos\github\clone> git clone --single-branch -b topic-56187-mount-module https://github.com/irkode/hugo-forum.git using-module
Cloning into 'using-module'...
remote: Enumerating objects: 75, done.
remote: Counting objects: 100% (51/51), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 75 (delta 12), reused 46 (delta 11), pack-reused 24 (from 1)
Receiving objects: 100% (75/75), 36.33 KiB | 1.30 MiB/s, done.
Resolving deltas: 100% (15/15), done.
PS C:\_repos\github\clone> git clone --single-branch -b topic-56187-mount-config https://github.com/irkode/hugo-forum.git using-config
Cloning into 'using-config'...
remote: Enumerating objects: 80, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 80 (delta 15), reused 51 (delta 14), pack-reused 24 (from 1)
Receiving objects: 100% (80/80), 37.44 KiB | 1.21 MiB/s, done.
Resolving deltas: 100% (18/18), done.
PS C:\_repos\github\clone> cd .\using-module\
PS C:\_repos\github\clone\using-module> hugo config mounts
{
"path": "project",
"version": "",
"time": "0001-01-01T00:00:00Z",
"owner": "",
"dir": "C:\\_repos\\github\\clone\\using-module",
"mounts": [
{
"source": "content\\en",
"target": "content"
},
{
"source": "data",
"target": "data"
},
{
"source": "layouts",
"target": "layouts"
},
{
"source": "i18n",
"target": "i18n"
},
{
"source": "archetypes",
"target": "archetypes"
},
{
"source": "assets",
"target": "assets"
},
{
"source": "static",
"target": "static"
}
]
}
{
"path": "c:/_my/module",
"version": "",
"time": "0001-01-01T00:00:00Z",
"owner": "project",
"dir": "c:\\_my\\module\\",
"mounts": [
{
"source": "README_ONE.md",
"target": "content\\readme\\index.md"
}
]
}
PS C:\_repos\github\clone\using-module> cd ..\using-config\
PS C:\_repos\github\clone\using-config> hugo config mounts --config "hugo.yaml,module.yaml"
{
"path": "project",
"version": "",
"time": "0001-01-01T00:00:00Z",
"owner": "",
"dir": "C:\\_repos\\github\\clone\\using-config",
"mounts": [
{
"source": "content\\en",
"target": "content"
},
{
"source": "c:\\_my\\module\\README_ONE.md",
"target": "content\\readme\\index.md"
},
{
"source": "data",
"target": "data"
},
{
"source": "layouts",
"target": "layouts"
},
{
"source": "i18n",
"target": "i18n"
},
{
"source": "archetypes",
"target": "archetypes"
},
{
"source": "assets",
"target": "assets"
},
{
"source": "static",
"target": "static"
}
]
}