Alternative to symlinks

I want to reference markdown files from one language to use them in another language of the website (three german versions for germany, austria and switzerland, most files are identitcal).

One solution would be to use symlinks but the problem is that this does not work on windows.

Any idea to tell hugo that he should pull the contents from another location?

Iā€™m not sure what you mean, but maybe https://gohugo.io/functions/readfile/ and https://gohugo.io/functions/readdir/ and https://gohugo.io/templates/files/ will help.

While this will not help you TODAY; in the next release we will add Hugo Modules. While that is a big topic, and the directory mount support is mainly targeted at Theme Components, I will make sure that you can configure this in the main project, too. So you can do something ala:

[module]
[[module.imports]]
path="github.com/bep/mycontent"
[[module.imports.mounts]]
source="src/markdown/docs"
target="content/docs"
language="en"
[[module.imports.mounts]]
source="src/markdown/blog"
target="content/blog"
language="en"

Etc.

When you consider that this also works with any supported external repo (GitHub) with proper version conrol etc., and for all component types in Hugo (assts, layouts, static, content ā€¦) it will be plenty powerful.

And not long away.

3 Likes

@maiki, sorry: This will probably not help since it will not take in account the front matter at compile time.

1 Like

@ju52: Yes ā€“ that would work on windows, indeed. But the build-server is linux. Only the development-machines are windows. So we need a cross-platform solution. :grimacing:

Another option: use WSL on the development machines.