Skip to content
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 · 14 comments
Closed

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

TiTi opened this issue Jan 1, 2017 · 14 comments
Assignees
Milestone

Comments

@TiTi
Copy link

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 Watch doesn't always watch on Ubuntu 16.04 #2774 but I did not have the issue with 0.17)

Running Hugo 0.18.1 on Windows 10

@bep
Copy link
Member

bep commented Jan 1, 2017

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

@moorereason
Copy link
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

@TiTi
Copy link
Author

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 Watch detect changes but do not rebuild (0.18.1) windows: Watch detect changes but do not rebuild (0.18.1) Jan 2, 2017
@moorereason
Copy link
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.

@TiTi
Copy link
Author

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
Copy link
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 windows: Watch detect changes but do not rebuild (0.18.1) Watch detect changes but do not rebuild home page in some cases Jan 3, 2017
@bep bep self-assigned this Jan 3, 2017
@TiTi
Copy link
Author

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
Copy link

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
Copy link
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 as completed in 9f20e64 Jan 5, 2017
@bep
Copy link
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
Copy link
Author

TiTi commented Jan 5, 2017

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

@TiTi
Copy link
Author

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)

@john-seb
Copy link

Faced a similar issue with the latest hugo_extended_0.80.0_Windows-64bit
So deleted all the html file folders that Hugo is meant to reproduce.
Cleared the AppData Local Hugo_cache.
cmd Hugo created all the deleted files within /public.
Copied and overwrote it in the root directory.

I host the website from root. One of these days I'll create that /docs for git pages

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants