I checked and there is no direct example of mounting files, it just says:
One or more glob patterns matching files or directories to include. If excludeFiles is not set, the files matching includeFiles will be the files mounted.
My issue was that I didn’t understand what it meant, what mounting meant. More precisely, when in the whole building chain files/directories were moved around (virtually). I thought it could before everything or after, moving around .html files. I got confused with both redirections and alternative urls.
All those notions share similarities, this is the kind of thing which I think confuses unexperienced laymen.
My mistake is mentioned indeed:
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
Problem is, that sounds like Chinese. What that really means is not obvious, nor what happens when you do forget it.
A short explanation in simple terms, might sound stupid but would help a lot. I know about system files, mounting usb sticks or disks, beside html and css this is about the common denominator to all amateur webdeveloppers. No need to go too basic, but pictures help.
What about the following - feel free to correct the terminology and make it a bit shorter perhaps, although too concise a wording and you loose people. In short, dumb it down in the spirit of the collection “for dummies”, when it makes sense.
Before mounts are considered:
├── content
│ └── docs …
│ └── intro.md
├── data
└── 2data
[module]
[[module.mounts]]
source = 'content'
target = 'content'
[[module.mounts]]
source = '2data'
target = 'data'
[[module.mounts]]
source = 'data'
target = 'data'
[[module.mounts]]
source = 'content/docs/intro.md'
target = 'content/_index.md'
In this example, directory 2data and data are fused as if all their content files were dumped into a third directory named “data”.
Without the third mount mapping “data” to “data”, the original “data” folder is erased instead of fusing with the new one. Mounting files, has the effect of moving them in the project arborescence and if the names of the source and target differ, renaming them too.
These virtual change occur before all building and processing, so what Hugo sees at the start of it is:
After the mounting, before building:
├── content
│ ├── docs …
│ └── _index.md \\ file content of intro.md
└── data \\ content of data + 2data
NB: When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it. In this case, without the first mapping of content to content, content is not seen at all, as if all content files had been deleted.