New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch detect changes but do not rebuild home page in some cases #2869

Closed
TiTi opened this Issue Jan 1, 2017 · 12 comments

Comments

Projects
None yet
4 participants
@TiTi

TiTi commented Jan 1, 2017

Hi,

I've upgraded from 0.17 to 0.18.1.
hugo server doesn't work has expected :

  • Start hugo server (no parameters)
  • Update a post and hit ctrl+S
  • "Change detected, rebuilding site" (ok good)
  • LiveReload works (page reloaded in my browser)
  • However the page stays the same, my change is not visible 😭

  • If I stop then relaunch hugo server, then F5 my browser, the change is visible
    (output log is the very same has when the change was detected)
  • If I edit config.toml, then the compile works: my change is visible!
    (similar to #2774 but I did not have the issue with 0.17)

Running Hugo 0.18.1 on Windows 10

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 1, 2017

Member

Any Windows users who can confirm this? (it obviously works fine for me on macOS).

Member

bep commented Jan 1, 2017

Any Windows users who can confirm this? (it obviously works fine for me on macOS).

@moorereason

This comment has been minimized.

Show comment
Hide comment
@moorereason

moorereason Jan 2, 2017

Contributor

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
Contributor

moorereason commented Jan 2, 2017

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
@TiTi

This comment has been minimized.

Show comment
Hide comment
@TiTi

TiTi Jan 2, 2017

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!

TiTi commented Jan 2, 2017

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!

@bep bep changed the title from Watch detect changes but do not rebuild (0.18.1) to windows: Watch detect changes but do not rebuild (0.18.1) Jan 2, 2017

@moorereason

This comment has been minimized.

Show comment
Hide comment
@moorereason

moorereason Jan 3, 2017

Contributor

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.

Contributor

moorereason commented Jan 3, 2017

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.

@TiTi

This comment has been minimized.

Show comment
Hide comment
@TiTi

TiTi Jan 3, 2017

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.

😢

TiTi commented Jan 3, 2017

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.

😢

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 3, 2017

Member

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.

Member

bep commented Jan 3, 2017

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.

@bep bep added the Bug label Jan 3, 2017

@bep bep added this to the v0.19 milestone Jan 3, 2017

@bep bep changed the title from windows: Watch detect changes but do not rebuild (0.18.1) to Watch detect changes but do not rebuild home page in some cases Jan 3, 2017

@bep bep self-assigned this Jan 3, 2017

@TiTi

This comment has been minimized.

Show comment
Hide comment
@TiTi

TiTi Jan 3, 2017

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.

TiTi commented Jan 3, 2017

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.

@SR-G

This comment has been minimized.

Show comment
Hide comment
@SR-G

SR-G Jan 4, 2017

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 commented Jan 4, 2017

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)

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 4, 2017

Member

@SR-G it is not related to this issue. Could you create a thread in the discussion forum about it? http://discuss.gohugo.io/

Member

bep commented Jan 4, 2017

@SR-G it is not related to this issue. Could you create a thread in the discussion forum about it? http://discuss.gohugo.io/

@bep bep closed this in 9f20e64 Jan 5, 2017

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 5, 2017

Member

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.

Member

bep commented Jan 5, 2017

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.

@TiTi

This comment has been minimized.

Show comment
Hide comment
@TiTi

TiTi Jan 5, 2017

Ok thanks, I will look into it.
Thanks for solving my issue :)

TiTi commented Jan 5, 2017

Ok thanks, I will look into it.
Thanks for solving my issue :)

@TiTi

This comment has been minimized.

Show comment
Hide comment
@TiTi

TiTi Jan 14, 2017

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)

TiTi commented Jan 14, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment