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

Use "publishdate" as default for "date" ? #2145

Closed
jcw opened this issue May 13, 2016 · 12 comments
Closed

Use "publishdate" as default for "date" ? #2145

jcw opened this issue May 13, 2016 · 12 comments

Comments

@jcw
Copy link

jcw commented May 13, 2016

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 the date = "..." field as well.

Would it be possible to auto-set the date field from the publishdate, if none is present?
Or to put it differently: make the date field default to publishdate?
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"?

Change detected, rebuilding site
2016-05-13 21:04 +0200
0 draft content
9 of 0 future rendered
132 pages created
[...]
@bep
Copy link
Member

bep commented May 13, 2016

Yes that makes sense.

@g3wanghc
Copy link
Contributor

@bep Future rendered bug fix on 836e3a7

@mubix
Copy link

mubix commented May 20, 2016

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.

@kaushalmodi
Copy link
Contributor

+1 for this feature.

In addition to what the OP said, if both data and publishdate are set in the frontmatter, then please set .Date to return the publishdate.

@kaushalmodi
Copy link
Contributor

@graemebenzie
Copy link

graemebenzie commented Sep 25, 2017

Line 31 https://github.com/netlify/netlify-cms/blob/caa5c69522e5446e8677775d7ea25fdbb0e2b36e/src/backends/backend.js

I found that I got this error because I had removed the Title field for the collection. For anybody stuck out there and googling

@stale
Copy link

stale bot commented Jan 23, 2018

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.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jan 23, 2018
@vassudanagunta
Copy link
Contributor

vassudanagunta commented Jan 23, 2018

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?

@stale stale bot removed the Stale label Jan 23, 2018
@bep bep closed this as completed Jan 23, 2018
@kaushalmodi
Copy link
Contributor

@bep @vassudanagunta

I think the issue is that the date in .Page.Params is left unset if only publishdate is set.

Test case

Notice the Page Params (Debug) section in the Hugo output linked above. Just as lastmod is auto-set based on publishdate, the request is that date also be auto-set if publishdate is specified, but date is not specified explicitly in the front-matter.

@vassudanagunta
Copy link
Contributor

@kaushalmodi

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.

@kaushalmodi
Copy link
Contributor

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

Would it be possible to auto-set the date field from the publishdate, if none is present?

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

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 Mar 8, 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

7 participants