shithub: hugo

Download patch

ref: bd1b019f8512f5c93d42d4b65785965b7b084d0b
parent: b345ca26cbf486d0406f2d14e16d10bb7d64b516
author: Jonathan Anderson <[email protected]>
date: Fri Jan 23 16:56:29 EST 2015

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").

--- a/create/content.go
+++ b/create/content.go
@@ -81,6 +81,10 @@
 		return false
 	}
 
+	if newmetadata == nil {
+		newmetadata = make(map[string]interface{})
+	}
+
 	if !caseimatch(newmetadata, "date") {
 		newmetadata["date"] = time.Now()
 	}