-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add automatic page date fallback #2239
Conversation
Vincent Batoufflet seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
I guess this is a fair compromise. |
@@ -663,6 +664,13 @@ func (p *Page) update(f interface{}) error { | |||
p.Draft = !*published | |||
} | |||
|
|||
if p.Date.IsZero() { | |||
fi, err := os.Stat(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), p.File.Path())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use the https://github.com/spf13/hugo/blob/master/hugofs/fs.go#L30 filesystem.
Hi, Thanks for the feedback. I just updated my PR to use hugofs. |
This causes a trouble if you are using Page in terms of WordPress: about/sitemap/privacy policy/etc which do not have |
Hi all, Maybe we can define a configuration option to toggle automatic date feature? WDYT? |
Yes, we need that, and set it to default = false. Could you create a PR? |
That would be great! 2016/07/01 16:25 "Bjørn Erik Pedersen" notifications@github.com:
|
Yes, I will create a PR. |
Hi All, Any suggestion on the setting name, e.g. |
@vbatoufflet see my comment on #2244 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
This PR adds an automatic value for
Page.Date
using the file'sModTime
as fallback when none is provided?Please let me know if it suits to you.
Regards.