To simplify:
git clone --single-branch -b hugo-forum-topic-37215 https://github.com/jmooring/hugo-testing hugo-forum-topic-37215
cd hugo-forum-topic-37215
hugo && tree public/
Result:
public/
├── post/
│ ├── test/
│ │ └── index.html
│ └── index.html
└── index.html
Now add this to config.toml:
[[module.mounts]]
source = "content"
target = "content"
And then this:
rm -rf public/ && hugo && tree public/
Produces this:
public/
├── foo/
│ ├── post/
│ │ └── test/
│ │ └── index.html
│ └── index.html
└── index.html
See https://gohugo.io/hugo-modules/configuration/#module-config-mounts
When the
mounts
config was introduced in Hugo 0.56.0, we were careful to preserve the existingstaticDir
and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add amounts
section you should remove the oldstaticDir
etc. settings.