summaryrefslogtreecommitdiffstats
path: root/hugolib/site.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-21 21:59:38 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-22 18:41:50 +0100
commita3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f (patch)
tree06cf1f647ae026b4fb3053c85370c2b203c7a089 /hugolib/site.go
parentcd07e6d57b158a76f812e8c4c9567dbc84f57939 (diff)
Fix Params case handling in the index, sort and where func
This means that you can now do: ``` {{ range where .Site.Pages "Params.MYPARAM" "foo" }} ```
Diffstat (limited to 'hugolib/site.go')
-rw-r--r--hugolib/site.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index db0cd2ea5..0b45c4803 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -28,6 +28,8 @@ import (
"strings"
"time"
+ "github.com/gohugoio/hugo/resources/resource"
+
"github.com/gohugoio/hugo/markup/converter"
"github.com/gohugoio/hugo/hugofs/files"
@@ -581,7 +583,7 @@ func (s *SiteInfo) Taxonomies() interface{} {
return s.s.Taxonomies
}
-func (s *SiteInfo) Params() map[string]interface{} {
+func (s *SiteInfo) Params() maps.Params {
return s.s.Language().Params()
}
@@ -654,14 +656,9 @@ type SiteSocial map[string]string
// Param is a convenience method to do lookups in SiteInfo's Params map.
//
-// This method is also implemented on Page and Node.
+// This method is also implemented on Page.
func (s *SiteInfo) Param(key interface{}) (interface{}, error) {
- keyStr, err := cast.ToStringE(key)
- if err != nil {
- return nil, err
- }
- keyStr = strings.ToLower(keyStr)
- return s.Params()[keyStr], nil
+ return resource.Param(s, nil, key)
}
func (s *SiteInfo) IsMultiLingual() bool {
@@ -1272,7 +1269,7 @@ func (s *Site) getMenusFromConfig() navigation.Menus {
s.Log.DEBUG.Printf("found menu: %q, in site config\n", name)
menuEntry := navigation.MenuEntry{Menu: name}
- ime, err := cast.ToStringMapE(entry)
+ ime, err := maps.ToStringMapE(entry)
if err != nil {
s.Log.ERROR.Printf("unable to process menus in site config\n")
s.Log.ERROR.Println(err)