Make sure Date and PublishDate is always set to a value if one is available

Fixes #3854
This commit is contained in:
Bjørn Erik Pedersen
2017-10-13 10:21:28 +02:00
parent 15ec031d98
commit 6a30874f19
3 changed files with 44 additions and 9 deletions

View File

@@ -1147,6 +1147,14 @@ func (p *Page) update(f interface{}) error {
}
p.Params["draft"] = p.Draft
if p.Date.IsZero() {
p.Date = p.PublishDate
}
if p.PublishDate.IsZero() {
p.PublishDate = p.Date
}
if p.Date.IsZero() && p.s.Cfg.GetBool("useModTimeAsFallback") {
fi, err := p.s.Fs.Source.Stat(filepath.Join(p.s.PathSpec.AbsPathify(p.s.Cfg.GetString("contentDir")), p.File.Path()))
if err == nil {