Hi,
I've upgraded from 0.17 to 0.18.1.
hugo server doesn't work has expected :
hugo server (no parameters)Running Hugo 0.18.1 on Windows 10
Any Windows users who can confirm this? (it obviously works fine for me on macOS).
Tested Hugo 0.18.1 (binary release) on Windows 10. Can't reproduce. Editor is Visual Studio Code.
@TiTi, what editor are you using? Can you run the following and see if the file on disk is actually rendered with your updates?
hugo server --renderToDisk
I'm using Notepad2 which is still working fine with hugo_0.17.exe. Same with other editors (ex: Sublime Text 3).
I've tried hugo server --renderToDisk : same result. However I've noticed the modification date is correctly changed (but not the content).
By digging further, I've notice the issue occurs only on the home page!
Maybe this is linked to my config.toml / custom theme : https://github.com/TiTi/hurock
I'll try later with an empty site from scratch, gotta go to work!
I can't reproduce this on the Hugo docs homepage with v0.18.1 or master. Make sure you're not seeing any template errors.
Ok so here is how to reproduce:
# Create a new site
hugo_0.18.1.exe new site test
cd test\themes
# Get my theme
git clone https://github.com/TiTi/hurock.git
cd ..
# Set up config
ECHO theme = "hurock">>config.toml
ECHO MetaDataFormat = "yaml">>config.toml
# Create an article
hugo_0.18.1.exe new posts/hello.md
ECHO hello world>>content/posts/hello.md
Ok now launch in watch mode:
hugo_0.18.1.exe server --buildDrafts
(or remove draft: true from hello.md and simply launch hugo_0.18.1.exe server)
Open your browser to http://localhost:1313/ and stay on the home page
Then make a change to hello.md :
ECHO test>>content/posts/hello.md
The browser refresh the page automatically (you have to be a good catch, so fast in localhost with no content).
But the added content does not appear.
Stopping hugo server (Ctrl^C) and relaunching it, then F5 in browser => changes visible !
There is no error in verbose mode, only warnings and they don't look related to the theme.
This is not a browser cache issue.
馃槩
Thanks a lot for that detailed report. With that I can reproduce it on macOS, too. I don't understand it, but if I can reproduce it, then I can fix it. But it looks like it is limited to the home page (which is even more weird).
But I will fix it. Thanks again.
You can also troubleshoot by checking what is happening when editing config.toml because in that case the changes appears with livereload, as I said in my original post.
I think i have a problem that may clearly be related, but not with the "server" mode of hugo, even with the html pages generation.
I create a new .md page with "draft = true".
I render the site (with a plain "hugo" command), the page is not generated (expected behavior as i don't use the build drafts option).
I switch that page to "draft = false" (or i remove the line my new .md page).
I republish the site through hugo (same way than before).
The page is now generated (expected behavior OK), the index.html includes the new post (also expected) BUT the "latests" block doesn't include the new post ! (my "latest" area is generated in the theme template with '{{ range $i, $p := (first 10 .Site.Pages) }}' => .Site.Pages doesn't include the new post).
I've reverted from 0.18.1 to 0.17, and i don't have the problem with 0.17.
I'm running under archlinux (host) / docker containers (under alpine), but i don't think this may be OS related.
(it seems at first glance from my side possibly related to this issue, but may need another distinct issue, i don't know)
@SR-G it is not related to this issue. Could you create a thread in the discussion forum about it? http://discuss.gohugo.io/
An added note: The reason it failed for you (and not for me and many others) is that you used the .Site.Pages collection on the home page -- this is perfectly fine, and should of course work on reloads (it does now), but:
Your templates will be more portable is you use .Pages instead (or: .Data.Pages, which is the same). (there are still use cases for the .Site.Pages collection, of course)
This is the contextual page collection. For the home page, this will be the same as .Site.Pages, for a taxonomy list page, it will be the pages in that taxonomy etc.
Ok thanks, I will look into it.
Thanks for solving my issue :)
Thank you for the precision.
.Pages doesn't work with Hugo 0.17 so I've switched to .Data.Pages instead (just so that my theme still work with an older Hugo binary)
Most helpful comment
Ok so here is how to reproduce:
Ok now launch in watch mode:
hugo_0.18.1.exe server --buildDrafts(or remove draft: true from hello.md and simply launch
hugo_0.18.1.exe server)Open your browser to http://localhost:1313/ and stay on the home page
Then make a change to hello.md :
ECHO test>>content/posts/hello.mdThe browser refresh the page automatically (you have to be a good catch, so fast in localhost with no content).
But the added content does not appear.
Stopping hugo server (Ctrl^C) and relaunching it, then F5 in browser => changes visible !
There is no error in verbose mode, only warnings and they don't look related to the theme.
This is not a browser cache issue.
馃槩