hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 29e786aac5b3674b26f24fae6a8dd6ad92a12137
parent e764a6e638b8a9e31df6d929c071c5a289441735
Author: Piotr Kowalczuk <p.kowalczuk.priv@gmail.com>
Date:   Thu, 25 Jun 2015 11:46:09 +0200

Proper parsing structured array from yaml based FrontMatter

Diffstat:
Mhugolib/page.go | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -518,11 +518,21 @@ func (p *Page) update(f interface{}) error {
 			default: // handle array of strings as well
 				switch vvv := vv.(type) {
 				case []interface{}:
-					var a = make([]string, len(vvv))
-					for i, u := range vvv {
-						a[i] = cast.ToString(u)
+					if len(vvv) > 0 {
+						switch vvv[0].(type) {
+						case map[interface{}]interface{}: // Proper parsing structured array from yaml based FrontMatter
+							p.Params[loki] = vvv
+						default:
+							a := make([]string, len(vvv))
+							for i, u := range vvv {
+								a[i] = cast.ToString(u)
+							}
+
+							p.Params[loki] = a
+						}
+					} else {
+						p.Params[loki] = []string{}
 					}
-					p.Params[loki] = a
 				default:
 					p.Params[loki] = vv
 				}