Local server: prevent caching of media files


Is it possible to prevent Hugo from preloading/caching static media files when running the local server?

Background: I need Hugo for presentations and lectures. The concept works perfectly, but unfortunately great amounts of media files let the terminal, browsers and the computer itself react very slowly.

Thank you—once more!

The built-in fileserver serves the files from memory and watches the file file system for changes. This is the default when running hugo server.

If you are restricted in the memory department you can try:

hugo server --watch=false --renderToDisk

Or a combination of the above.

1 Like

Wow! Just incredible how flexible and well-conceived Hugo really is.

Thanks a lot!


Noting to @rdwatters that renderToDisk is not documented in the docs or with the CLI. Shouldn’t it be?

It is in the autogenerated docs here:

… and it is in the CLI help output.

Ah, right. It’s in hugo server -h not hugo -h where I was looking. (and, it doesn’t show up in site search). Thanks.

For the curious out there, the hugo command also has a --renderToMemory flag, which, if you think about it, does not make much sense (where are the files?) … But it is used only for testing (benchmarking).