Browser not refreshing with hugo serve

This annoying problem happens once in a while.

I use hugo serve and view the site in my browser at localhost:1313. When I modify the source files, the browser will automatically be refreshed. But sometimes I have to manually refresh the page to see the changes.

This happens in both firefox and chrome(so not likely to be browser-specific), and in all hugo websites(not likely to be website-specific). does anybody have an idea about what went wrong?

Well I seem to find the problem. After reading the livereload docs, I now see that hugo need to inject livereload.js into the generated html.

Now I know that <body></body> is required for hugo to inject the livereload.js after some try&errors.

1 Like