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

Post with a timestamp in the future will not be visible even if defined time had past without restarting server #2776

Closed
Haocen opened this issue Sep 27, 2017 · 4 comments

Comments

@Haocen
Copy link

Haocen commented Sep 27, 2017

Environment Info

Node version(node -v):
v6.11.3

Your site _config.yml (Optional):
Related config:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: false

Your theme _config.yml (Optional):
N/A

Hexo and Plugin version(npm ls --depth 0):
hexo@3.3.9

For BUG

  1. BUG description:
    If hexo is set not to show future posts, then if the server is started before the post become visible, the post will not be shown even if the timestamp had past.

When doing hexo g after the timestamp had past, the post can be generated properly in public folder.

  1. The way to reproduce
  • Configure hexo not to show post in future.
  • Start the hexo server.
  • Create a post that will become visible in future.
  • Refresh the page without restarting the server after the timestamp goes into past, the post will still not be visible.
  1. Log with hexo --debug
    N/A

Related

#188

@NoahDragon
Copy link
Member

I believe this is what hexo intend to do so (because the future is set to false). As it is a static website generator, there is no dynamic loading in hexo process. Every post has to explicitly run the hexo g to be generated.

Although the hexo s listens all files changing, it only is triggered when the change event emitted. Moreover, the hexo s is designed for the testing purpose.

Even though hexo server could periodically check the post date, other static website hosts couldn't do the same, like Github.

Hope this could answer your question.

@Haocen
Copy link
Author

Haocen commented Sep 27, 2017

Is there an interface I can trigger a change event from external?

I can surely do touch on any file within the source/_posts but it feels like some undesired hack.

@NoahDragon
Copy link
Member

Or something like setting cron to run echo " " >> postfile? I don't see an elegant way to do it.

Or maybe set cron task to run hexo g when passing the post date.

@Haocen
Copy link
Author

Haocen commented Sep 27, 2017

So there is no interface to trigger the event? I'm surprised...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants