mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Handle empty front matter in archetype.
If an archetype has deliberately empty front matter (e.g., to suppress generation of the 'draft' field or to force a particular front matter type instead of the default TOML), we should handle it gracefully rather than panic ("assignment to entry in nil map").
This commit is contained in:
parent
b345ca26cb
commit
bd1b019f85
1 changed files with 4 additions and 0 deletions
|
@ -81,6 +81,10 @@ func NewContent(kind, name string) (err error) {
|
|||
return false
|
||||
}
|
||||
|
||||
if newmetadata == nil {
|
||||
newmetadata = make(map[string]interface{})
|
||||
}
|
||||
|
||||
if !caseimatch(newmetadata, "date") {
|
||||
newmetadata["date"] = time.Now()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue