Simplifying the siteInfo handling

This commit is contained in:
spf13 2014-05-28 18:37:59 -04:00
parent 280df4e380
commit 4076d77029

View file

@ -260,18 +260,7 @@ func (s *Site) initialize() (err error) {
} }
func (s *Site) initializeSiteInfo() { func (s *Site) initializeSiteInfo() {
paramsV, ok := viper.Get("Params").(map[interface{}]interface{}) params := viper.GetStringMap("Params")
// Warning: viper.Get(map_item) returns map[interface{}]interface{}
// even if .SetDefault called with a map[string]interface{}
if !ok {
paramsV = make(map[interface{}]interface{})
}
params := make(map[string]interface{}, len(paramsV))
for k, v := range paramsV {
if s, ok := k.(string); ok {
params[s] = v
}
}
permalinks := make(PermalinkOverrides) permalinks := make(PermalinkOverrides)
for k, v := range viper.GetStringMapString("Permalinks") { for k, v := range viper.GetStringMapString("Permalinks") {