hugo icon indicating copy to clipboard operation
hugo copied to clipboard

Add a way to avoid copying from /static

Open ghost opened this issue 5 years ago • 4 comments

I'm interested in having a 1GB+ staticDir under a consistent prefix, say /files.

It seems like however staticDir is set, it copies it into public/ and such. I'd rather hugo not manage that and copy it myself, while still being able to refer to the folder while running hugo server.

Would this be a useful new feature or is there already a way to do it?

Thank you!

ghost avatar Aug 23 '20 00:08 ghost

Would this be a useful new feature or is there already a way to do it?

  • The /static folder is currently copy-as-is
  • If you don't want that, then don't put anything in it
  • If you, as an example, create a symlink in /public/mybigfiles that will work exactly like a /static setup; Hugo does not need to know about that.

bep avatar Aug 23 '20 10:08 bep

Hi bep, thanks for replying.

If I make a symlink under content, I can see "mybigfiles" in hugo server. However, it gets copied when I hugo.

Is there a way that I can ignore that directory when running hugo or include content outside of content/ when running hugo server?

I guess I could symlink before hugo server and delete after hugo, potentially.

ghost avatar Aug 23 '20 15:08 ghost

So, the different folders in Hugo have different roles. If you put them below /my-site/foo then Hugo will not touch them.

bep avatar Aug 23 '20 18:08 bep

But if it's below that directory hugo server won't serve them, right?

I have worked around this for myself by just avoiding hugo server and doing a local webserver.

ghost avatar Aug 23 '20 19:08 ghost

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

github-actions[bot] avatar Aug 30 '25 02:08 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 15 '25 02:11 github-actions[bot]