1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

Make paginate settings configurable per language

Fixes #2449
This commit is contained in:
Bjørn Erik Pedersen
2016-09-15 09:32:52 +02:00
parent bbb11a4a0f
commit b86a605bfb
8 changed files with 32 additions and 11 deletions

View File

@@ -24,7 +24,6 @@ import (
"github.com/spf13/cast"
"github.com/spf13/hugo/helpers"
"github.com/spf13/viper"
)
// Pager represents one of the elements in a paginator.
@@ -358,7 +357,7 @@ func (n *Node) Paginate(seq interface{}, options ...interface{}) (*Pager, error)
func resolvePagerSize(options ...interface{}) (int, error) {
if len(options) == 0 {
return viper.GetInt("paginate"), nil
return helpers.Config().GetInt("paginate"), nil
}
if len(options) > 1 {
@@ -509,7 +508,7 @@ func newPaginator(elements []paginatedElement, total, size int, urlFactory pagin
}
func newPaginationURLFactory(pathElements ...string) paginationURLFactory {
paginatePath := viper.GetString("paginatePath")
paginatePath := helpers.Config().GetString("paginatePath")
return func(page int) string {
var rel string