Make auto-date disabled by default
authorVincent Batoufflet <vincent@batoufflet.info>
Wed, 6 Jul 2016 16:25:59 +0000 (18:25 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 8 Jul 2016 12:43:10 +0000 (14:43 +0200)
Fixes #2244
Closes #2260

commands/hugo.go
hugolib/page.go

index fa0467288fab92691b98700279ad670119b73be5..d91d75c4e4f19cc9ec7deac362888ee61339c1a4 100644 (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.
index 000551ec3a4219c02e39747cbf0c0901bbd8177e..9616bfbbd1ee2780fc3a685308afc8efba349d87 100644 (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()