projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c21e2b3
)
Add automatic page date fallback
author
Vincent Batoufflet
<vincent@batoufflet.info>
Mon, 27 Jun 2016 15:07:34 +0000
(17:07 +0200)
committer
Bjørn Erik Pedersen
<bjorn.erik.pedersen@gmail.com>
Tue, 28 Jun 2016 21:50:50 +0000
(23:50 +0200)
Closes #2239
hugolib/page.go
patch
|
blob
|
history
diff --git
a/hugolib/page.go
b/hugolib/page.go
index 198f7ba14ce9e7e6b201507c9138515cf5a10f7a..000551ec3a4219c02e39747cbf0c0901bbd8177e 100644
(file)
--- a/
hugolib/page.go
+++ b/
hugolib/page.go
@@
-663,6
+663,13
@@
func (p *Page) update(f interface{}) error {
p.Draft = !*published
}
+ if p.Date.IsZero() {
+ fi, err := hugofs.Source().Stat(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), p.File.Path()))
+ if err == nil {
+ p.Date = fi.ModTime()
+ }
+ }
+
if p.Lastmod.IsZero() {
p.Lastmod = p.Date
}