shithub: hugo

Download patch

ref: 75ba84acbf8469667cb41efa89b81526a18d6a0a
parent: f89eb349e4d6e9044fe54492f63f73317b1d6b0c
author: Bjørn Erik Pedersen <[email protected]>
date: Fri Jan 15 18:56:45 EST 2016

Add int and string cast template funcs

--- a/tpl/template_funcs.go
+++ b/tpl/template_funcs.go
@@ -1507,6 +1507,8 @@
 		"relref":       RelRef,
 		"apply":        Apply,
 		"chomp":        Chomp,
+		"int":          func(v interface{}) int { return cast.ToInt(v) },
+		"string":       func(v interface{}) string { return cast.ToString(v) },
 		"replace":      Replace,
 		"trim":         Trim,
 		"dateFormat":   DateFormat,