Make auto-date disabled by default

Fixes #2244
Closes #2260
This commit is contained in:
Vincent Batoufflet 2016-07-06 18:25:59 +02:00 committed by Bjørn Erik Pedersen
parent b581bbd856
commit b8af06f26a
2 changed files with 2 additions and 1 deletions

View file

@ -315,6 +315,7 @@ func loadDefaultSettings() {
viper.SetDefault("HasCJKLanguage", false)
viper.SetDefault("EnableEmoji", false)
viper.SetDefault("PygmentsCodeFencesGuessSyntax", false)
viper.SetDefault("UseModTimeAsFallback", false)
}
// InitializeConfig initializes a config file with sensible default configuration flags.

View file

@ -663,7 +663,7 @@ func (p *Page) update(f interface{}) error {
p.Draft = !*published
}
if p.Date.IsZero() {
if p.Date.IsZero() && viper.GetBool("UseModTimeAsFallback") {
fi, err := hugofs.Source().Stat(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), p.File.Path()))
if err == nil {
p.Date = fi.ModTime()