Hugo server not updating


Change detected, rebuilding site (#11).
2024-02-21 01:02:24.103 +0800
Template changed /partials/footer/friendlinks.html
Template added /partials/footer
Total in 506 ms

Change detected, rebuilding site (#12).
2024-02-21 01:02:24.617 +0800
Template added /partials/footer
Total in 590 ms

Similarly, if you modify the template code, the actual page code will not be updated, and you need to completely restart the monitoring task.


hugo -e development --gc --watch

@ZhangChengLin

I moved the comment above to this new topic. Adding things like “and something like this occurs” to existing topics is a distraction, and almost guarantees your “something like” will never be addressed.

Please provide version info.

"D:\Program Files\nodejs\npm.cmd" run hugo--dev:watch

> jzeg-net@0.0.1 hugo--dev:watch  
> hugo -e development --gc --watch

Start building sites … 
hugo v0.123.0-3c8a4713908e48e6523f058ca126710397aa4ed5+extended windows/amd64 BuildDate=2024-02-19T16:32:38Z VendorInfo=gohugoio

| ZH-CN | ZH-HK | ZH-MO | EN-WW | EN-US | DE-DE | ES-ES | RU-RU  
-------------------+-------+-------+-------+-------+-------+-------+-------+--------
  Pages            |   131 |     9 |     9 |     9 |   129 |     9 |     9 |     9
  Paginator pages  |     1 |     0 |     0 |     0 |     1 |     0 |     0 |     0
  Non-page files   |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0  
  Static files     |  7114 |  7114 |  7114 |  7114 |  7114 |  7114 |  7114 |  7114
  Processed images |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0
  Aliases          |     5 |     0 |     0 |     0 |     4 |     0 |     0 |     0
  Cleaned          |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0  

Built in 125897 ms
Watching for changes in F:\PhpstormProjects\GitHub\jzeg-net.github.io\{package.json,site}
Watching for config changes in F:\PhpstormProjects\GitHub\jzeg-net.github.io\config\_default, F:\PhpstormProjects\GitHub\jzeg-net.github.io\config\_default\languages, F:\PhpstormProjects\GitHub\jzeg-net.github.io\config\_default\m
enus, F:\PhpstormProjects\GitHub\jzeg-net.github.io\config\development
Press Ctrl+C to stop


Change detected, rebuilding site (#1).
2024-02-21 02:35:33.395 +0800
Template changed /_default/jump_link.html
Template added /_default
Total in 1141 ms

Change detected, rebuilding site (#2).
2024-02-21 02:35:34.539 +0800
Template added /_default
Total in 268 ms

Before upgrading to 0.123.0, the page could change after refreshing the page, and there was no problem. After upgrading today, the problem occurred.

Are you talking about modifying content, or modifying a template?

What I modified was the template code in the layouts directory.

I didn’t encounter any problems when modifying the content in the content directory.

With hugo v0.123.0-3c8a471390, I am unable to reproduce the problem as described when modifying content or layouts (including partials and content views). I am testing with a multilingual site, looking at both default language pages and other language pages.

But… I am testing on Linux not Windows.

Maybe we can wait and see if more people encounter this problem.

If you have time, you can try mine directly, but it may be relatively niche, similar to Bootstrap’s way of using hugo.

What’s the repo?

I tested on Windows, again with a multilingual site. The template updates were immediately shown in the browser regardless of language.

However, content updates in the non-default language were flakey, most of the time not updating. This was with hugo v0.123.0-eceeb19. Content updates in the default language were immediately shown.

Thank you for your attention, please read the second item first, because it is too complicated to fully reproduce.

1

During installation, in areas where image acceleration is not required, you need to remove the image option on line 76 (including the trailing comma on line 75), otherwise the installation of dependencies will not be successful. In addition, you need to use Nginx, for example, to correctly resolve the baseurl address. If you like, you can try it by changing it to localhost.

My problem is that after the correct installation is completed, in the environment after executing the script on line 17, if I modify the template code, the page refresh will not respond.
This is similar to line 21.



2

I just tried it and there is no problem with line 21. The page can be automatically refreshed immediately and the code updated. I have not used this script often before.

So currently I think, the difference is in the 2 lines below.


hugo -e development --gc --watch

hugo server -e development --gc

In the hugo command line development environment, there is no update after modifying the code (you need to refresh the page manually, and the page code does not change after manual refresh)

In the development environment of the hugo server command line, the modified code is automatically updated correctly.

I understand the difference between hugo and hugo server. The problem is not whether it needs to be done manually. The problem is that the page code has not changed.

To summarize, are you saying that hugo --watch does not detect all changes, but hugo server does?

Yes, there is a modified prompt on the command line, but the actual code has not changed.

How do you know? I obviously don’t understand this complex setup. Are you running another local server that is supposed to refresh your browser?

I saw with my bright eyes that the browser page code had not changed.

When I use this locally, I use nginx to access static pages and resolve the relevant domain names to local domain names by modifying the window local host file to simulate a real online environment.

This command modifies the code of the disk file system, while the hogo server command modifies the virtual file system (perhaps in memory) and does not actually modify the disk file. So I used nginx to parse the disk directory generated by hugo, and there was no problem. This was always done until v0.123.0 was released.

With v0.123.0 and later, Hugo server writes to the public directory, not to memory.

Is this a change? So what does v0.122.0 look like?

Are you saying that the following two commands now (v0.123.0) have the same effect?


hugo -e development --gc --watch

hugo server -e development --gc

Yes, that’s why I wrote, “With v0.123.0 and later…”

See https://gohugo.io/commands/hugo_server/#synopsis

I saw it, thanks.
Please write them in the documentation or better place to show the difference.

I can now see the changes using this command.

hugo server -e development --gc --disableFastRender

In my method, automatic refresh cannot be done for the time being. If it is planned, please ignore it.

I’m sorry that your local NGINX setup stopped working as desired after upgrading to v0.123.0.

I suggest you find a way to make your local NGINX setup work as-is, because I can’t see us spending any time on this.

Feel free to open a new topic if you can create a minimal reproducible example that demonstrates how the --watch flag behavior changed between v0.122.0 and v0.123.0.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.