if override, ok := p.Site.Permalinks[p.Section]; ok {
permalink, err = override.Expand(p)
+
if err != nil {
return nil, err
}
a[i] = cast.ToString(u)
}
page.Params[loki] = a
+ default:
+ page.Params[loki] = vv
}
}
}
"time"
"bitbucket.org/pkg/inflect"
+ "github.com/spf13/cast"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/source"
"github.com/spf13/hugo/target"
Taxonomies TaxonomyList
Source source.Input
Sections Taxonomy
- Info SiteInfo
+ Info *SiteInfo
Shortcodes map[string]ShortcodeFunc
timer *nitro.B
Target target.Output
Permalinks PermalinkOverrides
Params map[string]interface{}
}
+
+func (s *SiteInfo) GetParam(key string) interface{} {
+ v := s.Params[strings.ToLower(key)]
+
+ if v == nil {
+ return nil
+ }
+
+ switch v.(type) {
+ case bool:
+ return cast.ToBool(v)
+ case string:
+ return cast.ToString(v)
+ case int64, int32, int16, int8, int:
+ return cast.ToInt(v)
+ case float64, float32:
+ return cast.ToFloat64(v)
+ case time.Time:
+ return cast.ToTime(v)
+ case []string:
+ return v
+ }
+ return nil
}
type runmode struct {
if err != nil {
return err
}
- page.Site = s.Info
+ page.Site = *s.Info
page.Tmpl = s.Tmpl
page.Section = file.Section
page.Dir = file.Dir
func (s *Site) NewNode() *Node {
return &Node{
Data: make(map[string]interface{}),
- Site: s.Info,
+ Site: *s.Info,
}
}