-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Future content issue with date
and publishdate
params
#3977
Comments
I made this change, and I may have stepped on someone's toes here. But the front matter "date logic" is pretty elaborate, and there were several holes in it. So I still think 0.30 does it right. So,
To publish content with a future author date:
So, the change in 0.30 meant that you for the use case above may have to set 2 dates and not just one, which makes sense in my head. Less magic. The important part is that Hugo behaves oddly without a date ... and now it is more likely that we get one. |
We have always such a combination on frontmatter.
and in the
We choose the combo above because the @MunifTanjim please correct me if i'm wrong |
See also the older #2145. Without understanding all the intricacies of the discussion above, let me just describe my routine for over a year now: I write posts in advance and want them to come out at a specific date and time. For me, Right now, I add both of them to frontmatter (or rather: copy and edit), but does the 0.30 behaviour mean I can now drop one - and if so, which one? No big deal either way, just trying to understand. Feel free to close #2145 if it's no longer relevant. |
You can continue to use both if you want (which would also work on <= Hugo 0.30). For Hugo >= 0.30 you can "do what you want"
So you can usually drop one. But it depends on your use case. |
Thanks @bep for explanation. I as soon as the bugfix for sitemap is released I will test it with 0.30.1. My use case is to show upcoming events on my homepage as you can see on. |
To those who wonder why I wait another day 0.30.1 with the release. It is mostly automated, but I will kick my leg if someone reports another critical bug right after I release a patch for that ... So I let it linger a little. |
Take your time. |
date
and publishdate
paramsdate
and publishdate
params
I just stumbled upon this behavior when running 0.30.2 on my blog, where I use My expectation was that Hugo will, by default, render all content, unless it's marked as I personally prefer the old behavior. Having to add Perhaps it's the very existence of |
@mpaluchowski just to be clear: The current solution to your problem is to set both |
But thinking about it, I think the less confusing thing to do is to adjust the mentioned date logic so:
|
I publish future dated events on my sites, but prefer just to use |
I agree with @mpaluchowski to have a custom field like |
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
/cc @jinleileiking I noticed that your 2018-03-20 blog entry mentioned:
I guess what you are seeing is related to this. I guess you could either use the |
I will close this issue, as there is now a way to configure the dates however you want: [frontmatter]
date = ["date","publishDate", "lastmod"]
lastmod = ["lastmod", "date","publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"] |
After about 24 hours straight of trying to pinpoint what was going wrong with our site, this was it! I highly recommend you at least add this to the .30 release notes as this would have saved me hours of beating my head against the wall. And I am sure there are others. This is going to require an entire refactor of our site to use publishDate (if possible for what we'er doing). Could you maybe consider adding a flag option like --allowFutureDates to allow dates to be in the future? Update: I just saw that there IS a --buildFuture flag that works for both publishDate and dates. The flag can also be included in your config.toml file. Thank you. |
@bep Could you explain Thanks! |
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. |
Hugo version: 0.30
From the Hugo CLI documentation:
Previous Behavior
date
param set to a future date by default.publishdate
param set to a future date only with-F
or--buildFuture
flag enabled.Current Behavior
But with the 6a30874 commit, the value of
date
&publishdate
params will be same if one is absent in the front-matter.So, content with
date
param set to a future date will also be considered as future content and will not be rendered by default.Issue
Clearly one of the mentioned behavior is/was unintended (probably the current behavior, as I saw that the above-mentioned commit fixes an unrelated problem (#3854).
What if someone wants to publish a content with a future date before the date has arrived?
The text was updated successfully, but these errors were encountered: