How to replace symlinks to single files?

Hello.

My website relies heavily on symlinks, but I see they are no longer supported (Remove symlink support for the input files · Issue #11556 · gohugoio/hugo · GitHub).

I was able to replace symlinks to folders with module.mounts in hugo.yaml, but symlinks to files fail with “mount target must be one of: [archetypes assets content data i18n layouts static]”.

Hardlinks would work with Hugo, but not so well with Git as symlinks do.

This is only about symlinks inside the Hugo repo. Some of my content are in different repos that have symlinks themselves. They also broke and I have no idea how to fix.

BTW, is it possible to “mount” Hugo’s union file system?
I would like to continue having visility of my folder structure.

This works with v0.123.8 and later (and maybe earlier too):

[[module.mounts]]
source = 'foo.md'
target = 'content/foo.md'

But remember to include the default mount:

[[module.mounts]]
source = 'content'
target = 'content'

[[module.mounts]]
source = 'foo.md'
target = 'content/foo.md'

Thanks for the quick answer.
I see my mistake: I was trying to mount something outside of a component folder.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.