shithub: hugo

Download patch

ref: fb53987a4ff2acb9da8dec6ec7b11924d37352ce
parent: 662e12f348a638a6fcc92a416ee7f7c2a7ef8792
author: Bjørn Erik Pedersen <[email protected]>
date: Mon Jun 19 10:41:03 EDT 2017

hugolib: Fix error handling for JSON front matter

Fixes #3610

--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -1318,10 +1318,11 @@
 	p.lang = p.Source.File.Lang()
 
 	meta, err := psr.Metadata()
+	if err != nil {
+		return fmt.Errorf("failed to parse page metadata for %q: %s", p.File.Path(), err)
+	}
+
 	if meta != nil {
-		if err != nil {
-			return fmt.Errorf("failed to parse page metadata for %s: %s", p.File.Path(), err)
-		}
 		if err = p.update(meta); err != nil {
 			return err
 		}