Optimize for the common case in Blackfriday config

This commit is contained in:
bep 2015-01-31 23:45:38 +01:00
parent c50780930e
commit b984ec96bc

View file

@ -199,14 +199,17 @@ func (p *Page) getRenderingConfig() *helpers.Blackfriday {
pageParam := p.GetParam("blackfriday") pageParam := p.GetParam("blackfriday")
siteParam := viper.GetStringMap("blackfriday") siteParam := viper.GetStringMap("blackfriday")
combinedParam := make(map[string]interface{}) combinedParam := siteParam
for k, v := range siteParam {
combinedParam[k] = v
}
if pageParam != nil { if pageParam != nil {
combinedParam = make(map[string]interface{})
for k, v := range siteParam {
combinedParam[k] = v
}
pageConfig := cast.ToStringMap(pageParam) pageConfig := cast.ToStringMap(pageParam)
for key, value := range pageConfig { for key, value := range pageConfig {
combinedParam[key] = value combinedParam[key] = value
} }