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

Add automatic page date fallback #2239

Closed
wants to merge 1 commit into from
Closed

Add automatic page date fallback #2239

wants to merge 1 commit into from

Conversation

vbatoufflet
Copy link
Contributor

Hi,

This PR adds an automatic value for Page.Date using the file's ModTime as fallback when none is provided?

Please let me know if it suits to you.

Regards.

@CLAassistant
Copy link

CLAassistant commented Jun 27, 2016

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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.

@bep
Copy link
Member

bep commented Jun 27, 2016

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()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vbatoufflet
Copy link
Contributor Author

Hi,

Thanks for the feedback. I just updated my PR to use hugofs.

@bep bep closed this in eda3678 Jun 28, 2016
@luixxiul
Copy link

luixxiul commented Jul 1, 2016

This causes a trouble if you are using Page in terms of WordPress: about/sitemap/privacy policy/etc which do not have .Date suddenly start to appear in feeds or the list of recent posts.

@vbatoufflet
Copy link
Contributor Author

Hi all,

Maybe we can define a configuration option to toggle automatic date feature?

WDYT?

@bep
Copy link
Member

bep commented Jul 1, 2016

WDYT?

Yes, we need that, and set it to default = false. Could you create a PR?

@luixxiul
Copy link

luixxiul commented Jul 1, 2016

That would be great!

2016/07/01 16:25 "Bjørn Erik Pedersen" notifications@github.com:

WDYT?

Yes, we need that, and set it to default = false.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@vbatoufflet
Copy link
Contributor Author

Yes, I will create a PR.

@vbatoufflet
Copy link
Contributor Author

Hi All,

Any suggestion on the setting name, e.g. AutomaticFallbackDates or AutoDates?

@bep
Copy link
Member

bep commented Jul 6, 2016

@vbatoufflet see my comment on #2244

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants