mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
hugolib: Implement "related content"
This closes #98, even if this commit does not do full content text search. We may revisit that problem in the future, but that deserves its own issue. Fixes #98
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/spf13/cast"
|
||||
@@ -641,3 +642,8 @@ func (ns *Namespace) Uniq(l interface{}) (interface{}, error) {
|
||||
}
|
||||
return ret.Interface(), nil
|
||||
}
|
||||
|
||||
// KeyVals creates a key and values wrapper.
|
||||
func (ns *Namespace) KeyVals(key interface{}, vals ...interface{}) (types.KeyValues, error) {
|
||||
return types.KeyValues{Key: key, Values: vals}, nil
|
||||
}
|
||||
|
@@ -63,6 +63,13 @@ func init() {
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.KeyVals,
|
||||
[]string{"keyVals"},
|
||||
[][2]string{
|
||||
{`{{ keyVals "key" "a" "b" }}`, `key: [a b]`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.In,
|
||||
[]string{"in"},
|
||||
[][2]string{
|
||||
|
Reference in New Issue
Block a user