aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-09-23 14:53:07 -0700
committerBjørn Erik Pedersen <[email protected]>2024-09-27 11:19:27 +0200
commit4c02a52f7c4de651394d01ff4d57d0d380c7b81a (patch)
treef2ed15322b6897cc7266d1faea3ad83433b51375 /resources
parent578442f8923d624f2937d0c09acb1a6f93d5bba5 (diff)
downloadhugo-4c02a52f7c4de651394d01ff4d57d0d380c7b81a.tar.gz
hugo-4c02a52f7c4de651394d01ff4d57d0d380c7b81a.zip
resources/page: Validate predefined front matter dates
Closes #10717
Diffstat (limited to 'resources')
-rw-r--r--resources/page/pagemeta/page_frontmatter.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/resources/page/pagemeta/page_frontmatter.go b/resources/page/pagemeta/page_frontmatter.go
index 0e0650934..9491bf1bc 100644
--- a/resources/page/pagemeta/page_frontmatter.go
+++ b/resources/page/pagemeta/page_frontmatter.go
@@ -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
}