-
-
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
Use "publishdate" as default for "date" ? #2145
Comments
Yes that makes sense. |
@bep Future rendered bug fix on 836e3a7 |
Agreed, I'd love not to have the exact same data in my posts twice (more chance for me to mess them up) Originally when I started looking into "Future content" I couldn't find any documentation at all on how to set them up. (Google for "Hugo Future Content" or "Scheduled Posts" didn't result in much). So I just tried to set the date in the future. No joy. However I think that would be the intuitive move here. Just check date to see if it's in the future instead of separate fields. Unless there is a valid reason for keeping them separate. |
+1 for this feature. In addition to what the OP said, if both data and publishdate are set in the frontmatter, then please set |
I have found this workaround for now: https://discuss.gohugo.io/t/how-to-use-the-publishdate-if-both-publishdate-and-date-are-set-in-frontmatter/5142/2?u=kaushalmodi |
I found that I got this error because I had removed the Title field for the collection. For anybody stuck out there and googling |
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. |
This is the current code: if p.Date.IsZero() {
p.Date = p.PublishDate
}
if p.PublishDate.IsZero() {
p.PublishDate = p.Date
} @bep Shouldn't this be marked as fixed? |
I think the issue is that the Test caseNotice the Page Params (Debug) section in the Hugo output linked above. Just as |
Since this issue is nearly 2 years old, and was fixed by #3854 per its title and description quite a while ago, I'd say create a new issue for what you describe. |
@vassudanagunta I can create a new issue, but the test case I linked simply shows that the request in the original post of this issue is not met:
|
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. |
A small feature request, if I may...
I write all my posts in advance, and then publish them on specific days at midnight (I've been doing this for years, switched from WP to Hugo a few months ago, and am so glad I finally did! - FWIW). I'm about to streamline the process by having Hugo regenerate and upload the weblog daily at midnight.
This can be automated by entering a
publishdate = "..."
, which is great. But I still need to enter thedate = "..."
field as well.Would it be possible to auto-set the
date
field from thepublishdate
, if none is present?Or to put it differently: make the
date
field default topublishdate
?Right now, omitting the
date
value will timestamp the posts as Jan, 0001.Assuming I'm not overlooking some feature in Hugo.
It's a small change, I hope - but just that little nudge extra to make posting more enjoyable still...
Cheers,
-jcw
PS. And a minor minor bug report, I think: the "9 of 0" below should perhaps be "9 of 9"?
The text was updated successfully, but these errors were encountered: