aboutsummaryrefslogtreecommitdiffhomepage
path: root/navigation
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-11-21 21:59:38 +0100
committerBjørn Erik Pedersen <[email protected]>2019-11-22 18:41:50 +0100
commita3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f (patch)
tree06cf1f647ae026b4fb3053c85370c2b203c7a089 /navigation
parentcd07e6d57b158a76f812e8c4c9567dbc84f57939 (diff)
downloadhugo-a3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f.tar.gz
hugo-a3fe5e5e35f311f22b6b4fc38abfcf64cd2c7d6f.zip
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 'navigation')
-rw-r--r--navigation/menu.go3
-rw-r--r--navigation/pagemenus.go6
2 files changed, 6 insertions, 3 deletions
diff --git a/navigation/menu.go b/navigation/menu.go
index 2cf9722e9..ae2e0e4ff 100644
--- a/navigation/menu.go
+++ b/navigation/menu.go
@@ -14,6 +14,7 @@
package navigation
import (
+ "github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/compare"
@@ -59,7 +60,7 @@ type Page interface {
Section() string
Weight() int
IsPage() bool
- Params() map[string]interface{}
+ Params() maps.Params
}
// Menu is a collection of menu entries.
diff --git a/navigation/pagemenus.go b/navigation/pagemenus.go
index 443c8cd61..352a91557 100644
--- a/navigation/pagemenus.go
+++ b/navigation/pagemenus.go
@@ -14,6 +14,8 @@
package navigation
import (
+ "github.com/gohugoio/hugo/common/maps"
+
"github.com/pkg/errors"
"github.com/spf13/cast"
)
@@ -73,7 +75,7 @@ func PageMenusFromPage(p Page) (PageMenus, error) {
}
// Could be a structured menu entry
- menus, err := cast.ToStringMapE(ms)
+ menus, err := maps.ToStringMapE(ms)
if err != nil {
return pm, errors.Wrapf(err, "unable to process menus for %q", p.LinkTitle())
}
@@ -81,7 +83,7 @@ func PageMenusFromPage(p Page) (PageMenus, error) {
for name, menu := range menus {
menuEntry := MenuEntry{Page: p, Name: p.LinkTitle(), Weight: p.Weight(), Menu: name}
if menu != nil {
- ime, err := cast.ToStringMapE(menu)
+ ime, err := maps.ToStringMapE(menu)
if err != nil {
return pm, errors.Wrapf(err, "unable to process menus for %q", p.LinkTitle())
}