Hugo

Option to retain symlinks in static/ dir?

Hello,

I am planning to also use hugo to generate pages for my personal stuff at work. But that involves symlinking to many resources like PDF files, etc.

Currently I manage that manually and point to the resources using symlinks.

I would like to continue to do the same when switching to hugo. I tried doing that, the symlinks in static/ dir convert to physical copies in the public/ dir. Things are still functionally the same, but all all the symlinks collectively result in 100’s of MB of data, the hugo export becomes very slow. Also I would prefer to have the symlinks stay as they so that I do not need to remove stuff from public/ that got removed from the linked dir. Example for this is that if I have a symlink to a directory called articles/, and I publish hugo, everything from articles/ will get copied over to public/. Tomorrow, if I delete one of the files in articles/, that will still remain in public/. I want to avoid that.

Summary: Can you please add an option to retain the "symlink"ness as it is when copying from static/ to public/? i.e. if I have a link pointing to ~/articles in static/, I should have the same link in public/ too.


PS: Should I be making feature requests here, or in Github issues?

This has been discussed before. I don’t think Hugo will ever copy your symlinks from /static to /public – that would be near impossible to do in a cross platform and static and web server agnostic way.

So what you should consider instead is the create the symlinks directly in /public

OK. I will do that… probably just have a wrapper script to make links in public/ after publishing.