Unfortunately I have the same problem and live reloading on my machine suddenly has stopped from working. I can’t figure out why.
I’m on
Hugo Static Site Generator v0.57.2/extended darwin/amd64 BuildDate: unknown
These are the messages I get on starting Hugo:
Total in 248 ms
Watching for changes in /Users/cl/c11h-website-raw/{archetypes,assets,content,data,i18n,layouts,static}
Watching for config changes in /Users/cl/c11h-website-raw/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
Upon changes Hugo reports success:
Change detected, rebuilding site.
2019-09-04 17:58:23.463 +0200
Source changed "/Users/cl/c11h-website-raw/content/home/hero.md": WRITE
WARN 2019/09/04 17:58:23 Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function.
WARN 2019/09/04 17:58:23 Page's .LanguagePrefix is deprecated and will be removed in a future release. Use .Site.LanguagePrefix.
Total in 23 ms
But nothing happens in the browser Changes only show up if I restart Hugo and manually refresh the browser.
This is what I’ve tried so far:
manually refresh the browser after each change
hugo server --buildDrafts
hugo server --watch --buildDrafts
hugo server --disableFastRender
hugo server --buildDrafts --disableFastRender
tried (several) other browser(s) (Firefox is my default)
cleared the browser cache
checked the console for errors
restarted my machine
Nothing helped. I have no clue what to do or how to debug. Thanks in advance for your help.
Just a note from the hair-splitter that I am: In HTML5 you do not need to have html, head or body tags. If you make the live reload dependant on these tags we might get some more of these issues.
I can also report that in the meantime I checked out previous commits just to make sure it isn’t a content and/or code related issue. But it doesn’t make a difference.
The crazy thing is: it used to work and then stopped.
Together with our OPS-Team we investigated this issue further and I’m sorry to report back that this seems to be a bug in newer versions of Hugo. Here is, what we found out:
changes in templates (“template changed”) are reflected in the browser and in the source code
changes in md files (“source changed”) are not
the browser reload is triggered in both cases, so its not livereload.js related
After this finding we unistalled Hugo completely and installed several releases locally. This is the outcome:
v0.58.0 => not working
v0.57.0 => not working
v0.56.3 => not working
v0.55.6 => not working
v0.55.4 => working
So this must have been introduced in version 0.55.6. I’ll file a bug report accordingly.
I would like to let you have a look in our Github Repo but we are in company environment and making the repo public is not compliant.
I still register problems with LiveReload if I change partials “loaded” by shortcode.
When I make a change, LiveReload detects the change but nothing change in broser.
I have to restart hugo server and manually refresh the browser.
Hint 1: try hugo server --disableFastRender. this is supposed to re-render every page every time.
Hint 2: Check your templates. If that partial is loaded via partialCached it might be, that it is loaded from cache, which might be a bug in the case it was changed. If you have partials that load partials it might build up a chain where the first partial is cached and all else below is ignored. I had this issue once and “fixed” it by lowering my partial complexity.
@davidsneighbour I tried lots of advice across the forum, but nothing helped (also what you mentioned).
Can settings of my browser (chrome) influence the LiveReload correct function?
FYI, live reloading wasn’t working for me either. Turns out I had something else (Svelte in dev mode) that was also running livereload.js. I disabled Svelte’s use of livereload and, voila, Hugo’s live reload started working again! This explained the error messages I was getting in my console: attempts to connect to 35729 even if I told Hugo to use a different port (Svelte was still using 35729 by default). Invoking livereload.js, once by Hugo and once by Svelte, was the probable cause.
For others, it might not be Svelte but something else mixed in with your Hugo that also use the livereload.js (which isn’t unique to Hugo).
Update: It was rollup.js, which builds Svelte components, that was adding livereload.js. So, if you are using rollup.js with live reload enabled for anything else, that could cause trouble for you.