mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Make sure Date and PublishDate is always set to a value if one is available
Fixes #3854
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user