HUGO

Weird issue: changing an SVG background image reloads `hugo server` but leads to white page

You can test this with my repo in the latest version. I am running npm run server which runs a paranoid hugo server script (in bin/hugo-dev-server.sh). Then I am changing something in static/images/bg.svg and save and the server sees the changes, reloads, but the resulting page is white. This weirdly happens only if I change anything that is in SVG format. I remember seeing it when I did changes on my favicon earlier this month. Changing a markdown file or a layout file will update properly. Restarting the server will apply the changes.

Is this just me and my weird computer or is one of the “special” server run settings too restrictive for Hugo?

SVG is a vector file format.

Quote from here:

Vectors, in mathematics, are numerical representations of movement or of a difference in two states. They describe how to get from here to there. Usually represented as a list of numbers, they break down the overall change between the two states into the net displacement as measured in different, independent dimensions. For 2D graphics, the dimensions are usually horizontal ( x ) and vertical ( y ).

I wouldn’t expect the Hugo server to handle overwriting such a file.
When in this situation, I simply quit the server and spin it up again.

So I don’t think that this happens due to your setup, I have encountered this, as well.

I maybe described that not fully, but the SVG file is in static. And the file is only copied. Then the server reloads (so it actually sees the file changing) and then the whole page is white, not just the place where the image would come up. I wouldn’t expect Hugo to do anything other than just copying the SVG file from static to the server?

If this behaviour is hampering your workflow then I suggest that you open an issue at the master repo on GitHub to get a proper response.

As mentioned above I have also encountered similar issues (i.e. a blank page) while running the Hugo server and overwriting or copying image files, -even more so with SVG-.

But I haven’t quite given it a second thought as I tend to be in a hurry when designing a website.

2 Likes