shithub: hugo

Download patch

ref: 0595f27e6d442ca851e3cf065a95f5e3471c6be6
parent: 19538a1bd6732930977654b9a61c33adbb9e533f
author: Noah Campbell <noahcampbell@gmail.com>
date: Sat Aug 3 06:52:40 EDT 2013

Using a composite literal to create a page.

Wonder why the need for composite structs.  Not sure if my go knowledge is lacking or if this is cruft from other programming language doctrine.

--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -77,14 +77,13 @@
 func (p Pages) Limit(n int) Pages { return p[0:n] }
 
 func initializePage(filename string) (page Page) {
-	page = Page{}
+	page = Page{contentType: "",
+		File: File{FileName: filename,
+		Extension: "html"},
+		Params: make(map[string]interface{}),
+		Node: Node{Keywords: make([]string, 10, 30)},
+		Markup: "md"}
 	page.Date, _ = time.Parse("20060102", "20080101")
-	page.FileName = filename
-	page.contentType = ""
-	page.Extension = "html"
-	page.Params = make(map[string]interface{})
-	page.Keywords = make([]string, 10, 30)
-	page.Markup = "md"
 	page.setSection()
 
 	return page
--