resources/page: Validate predefined front matter dates

Closes #10717
This commit is contained in:
Joe Mooring
2024-09-23 14:53:07 -07:00
committed by Bjørn Erik Pedersen
parent 578442f892
commit 4c02a52f7c
3 changed files with 27 additions and 24 deletions

View File

@@ -330,6 +330,9 @@ type FrontMatterDescriptor struct {
// if page is a leaf bundle, the bundle folder name (ContentBaseName).
BaseFilename string
// The Page's path if the page is backed by a file, else its title.
PathOrTitle string
// The content file's mod time.
ModTime time.Time
@@ -736,7 +739,7 @@ func (f *frontmatterFieldHandlers) newDateFieldHandler(key string, setter func(d
var err error
date, err = htime.ToTimeInDefaultLocationE(v, d.Location)
if err != nil {
return false, nil
return false, fmt.Errorf("invalid front matter: %s: %s: see %s", key, v, d.PathOrTitle)
}
d.PageConfig.Params[key] = date
}