diff options
author | spf13 <steve.francia@gmail.com> | 2014-04-24 16:11:08 -0600 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-04-24 16:11:08 -0600 |
commit | bdf7cd9f9d8c393e9850375d1b4d45c3096561f8 (patch) | |
tree | 07f3d07ef8731a3c7a9aafa041fb7b4fe947d2e2 /hugolib/menu.go | |
parent | ac82fe32af2d3f9a5ff56a9b7153da958a23c959 (diff) |
Creating site menu configuration and have the docs site use it
Diffstat (limited to 'hugolib/menu.go')
-rw-r--r-- | hugolib/menu.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/hugolib/menu.go b/hugolib/menu.go index 7c43cfe15..abbdf2811 100644 --- a/hugolib/menu.go +++ b/hugolib/menu.go @@ -13,7 +13,12 @@ package hugolib -import "sort" +import ( + "sort" + "strings" + + "github.com/spf13/cast" +) type MenuEntry struct { Url string @@ -39,6 +44,22 @@ func (me *MenuEntry) HasChildren() bool { return me.Children != nil } +func (me *MenuEntry) MarshallMap(ime map[string]interface{}) { + for k, v := range ime { + loki := strings.ToLower(k) + switch loki { + case "url": + me.Url = cast.ToString(v) + case "weight": + me.Weight = cast.ToInt(v) + case "name": + me.Name = cast.ToString(v) + case "parent": + me.Parent = cast.ToString(v) + } + } +} + //func (me *MenuEntry) RelUrl() string { //link, err := p.permalink() //if err != nil { |