"time"
"github.com/gohugoio/hugo/common/maps"
+ "github.com/spf13/cast"
"github.com/gohugoio/hugo/common/types"
"github.com/mitchellh/mapstructure"
vv = vc
}
keywords = append(keywords, StringsToKeywords(vv...)...)
+ case []any:
+ return cfg.ToKeywords(cast.ToStringSlice(vv))
case time.Time:
layout := "2006"
if cfg.Pattern != "" {
})
}
+func TestToKeywordsAnySlice(t *testing.T) {
+ c := qt.New(t)
+ var config IndexConfig
+ slice := []any{"A", 32, "C"}
+ keywords, err := config.ToKeywords(slice)
+ c.Assert(err, qt.IsNil)
+ c.Assert(keywords, qt.DeepEquals, []Keyword{
+ StringKeyword("A"),
+ StringKeyword("32"),
+ StringKeyword("C"),
+ })
+}
+
func BenchmarkRelatedNewIndex(b *testing.B) {
pages := make([]*testDoc, 100)
numkeywords := 30