mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
@@ -17,9 +17,20 @@
|
||||
// string operations on content.
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// ConfigProvider provides the configuration settings for Hugo.
|
||||
type ConfigProvider interface {
|
||||
GetString(key string) string
|
||||
GetInt(key string) int
|
||||
GetStringMap(key string) map[string]interface{}
|
||||
GetStringMapString(key string) map[string]string
|
||||
}
|
||||
|
||||
// Config returns the currently active Hugo config. This will be set
|
||||
// per site (language) rendered.
|
||||
func Config() ConfigProvider {
|
||||
return viper.Get("CurrentContentLanguage").(ConfigProvider)
|
||||
}
|
||||
|
@@ -84,9 +84,9 @@ func (l *Language) SetParam(k string, v interface{}) {
|
||||
l.params[k] = v
|
||||
}
|
||||
|
||||
func (l *Language) GetBool(key string) bool { return cast.ToBool(l.Get(key)) }
|
||||
|
||||
func (l *Language) GetBool(key string) bool { return cast.ToBool(l.Get(key)) }
|
||||
func (l *Language) GetString(key string) string { return cast.ToString(l.Get(key)) }
|
||||
func (l *Language) GetInt(key string) int { return cast.ToInt(l.Get(key)) }
|
||||
|
||||
func (ml *Language) GetStringMap(key string) map[string]interface{} {
|
||||
return cast.ToStringMap(ml.Get(key))
|
||||
|
@@ -341,7 +341,7 @@ func GetRelativePath(path, base string) (final string, err error) {
|
||||
|
||||
// PaginateAliasPath creates a path used to access the aliases in the paginator.
|
||||
func PaginateAliasPath(base string, page int) string {
|
||||
paginatePath := viper.GetString("paginatePath")
|
||||
paginatePath := Config().GetString("paginatePath")
|
||||
uglify := viper.GetBool("UglyURLs")
|
||||
var p string
|
||||
if base != "" {
|
||||
|
Reference in New Issue
Block a user