mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 09:02:06 -05:00
parent
7615ef0c28
commit
a04abf0dda
1 changed files with 15 additions and 3 deletions
|
@ -1908,7 +1908,13 @@ func relURL(a interface{}) (template.HTML, error) {
|
||||||
func init() {
|
func init() {
|
||||||
funcMap = template.FuncMap{
|
funcMap = template.FuncMap{
|
||||||
"absURL": absURL,
|
"absURL": absURL,
|
||||||
"absLangURL": func(a string) template.HTML { return template.HTML(helpers.AbsURL(a, true)) },
|
"absLangURL": func(i interface{}) (template.HTML, error) {
|
||||||
|
s, err := cast.ToStringE(i)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return template.HTML(helpers.AbsURL(s, true)), nil
|
||||||
|
},
|
||||||
"add": func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '+') },
|
"add": func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '+') },
|
||||||
"after": after,
|
"after": after,
|
||||||
"apply": apply,
|
"apply": apply,
|
||||||
|
@ -1962,7 +1968,13 @@ func init() {
|
||||||
"readFile": readFileFromWorkingDir,
|
"readFile": readFileFromWorkingDir,
|
||||||
"ref": ref,
|
"ref": ref,
|
||||||
"relURL": relURL,
|
"relURL": relURL,
|
||||||
"relLangURL": func(a string) template.HTML { return template.HTML(helpers.RelURL(a, true)) },
|
"relLangURL": func(i interface{}) (template.HTML, error) {
|
||||||
|
s, err := cast.ToStringE(i)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return template.HTML(helpers.RelURL(s, true)), nil
|
||||||
|
},
|
||||||
"relref": relRef,
|
"relref": relRef,
|
||||||
"replace": replace,
|
"replace": replace,
|
||||||
"replaceRE": replaceRE,
|
"replaceRE": replaceRE,
|
||||||
|
|
Loading…
Reference in a new issue