Add Lastmod field

Create new field in Node
Update Page to look for lastmod field in the front matter. If not present, then assign Date to Lastmod
Update Site, to assign a value to Lastmod (based on the same logic used for Date)

Fixes #733
This commit is contained in:
Juan B. Rodriguez
2015-05-14 15:06:36 -05:00
committed by bep
parent be534a865d
commit 3882e7ceaf
3 changed files with 18 additions and 0 deletions

View File

@@ -473,6 +473,11 @@ func (p *Page) update(f interface{}) error {
if err != nil {
jww.ERROR.Printf("Failed to parse date '%v' in page %s", v, p.File.Path())
}
case "lastmod":
p.Lastmod, err = cast.ToTimeE(v)
if err != nil {
jww.ERROR.Printf("Failed to parse lastmod '%v' in page %s", v, p.File.Path())
}
case "publishdate", "pubdate":
p.PublishDate, err = cast.ToTimeE(v)
if err != nil {
@@ -524,6 +529,11 @@ func (p *Page) update(f interface{}) error {
}
}
}
if p.Lastmod.IsZero() {
p.Lastmod = p.Date
}
return nil
}