mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-26 00:41:13 +00:00
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.
This commit is contained in:
parent
19538a1bd6
commit
0595f27e6d
1 changed files with 6 additions and 7 deletions
|
@ -77,14 +77,13 @@ func (p Pages) Sort() { sort.Sort(p) }
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue