I use the Hugo static site generator to generate the HTML and CSS that makes this site look and behave the way it does.
It’s a great tool, but if you run a site like this one that has a lot of static content, you may find that hugo server -D
or hugo server -DF
starts crashing for you, possibly without any error messages, as below:
Based on my limited understanding, the issue here is that hugo server
attempts to hold your whole site and its static content in memory, which causes a crash if the site is large. Adding the --renderToDisk
flag forces hugo to dump your site to disk instead, which seems to solve the problem:
hugo server -DF --renderToDisk
Don’t worry: even if you add the --renderToDisk
flag, hugo server
continues to watch your site for
changes and will update the content at localhost:1313 when things change.
Warning: If you run the command exactly as it is above, you may end up with current and future drafts of your posts getting saved in the directory where your hugo site lives. You could accidentally publish those when you run hugo deploy
. To avoid this, I always deploy with:
hugo --cleanDestinationDir
hugo deploy --invalidateCDN=true
That’s it! Hope it saves you some crashes!