adding helper to create absolute url

This commit is contained in:
spf13 2013-07-10 17:57:28 -04:00
parent d4caa8ee95
commit f857f4caba

View file

@ -22,6 +22,7 @@ import (
"regexp"
"strconv"
"strings"
"html/template"
"time"
)
@ -147,6 +148,13 @@ func Urlize(url string) string {
return Sanitize(strings.ToLower(strings.Replace(strings.TrimSpace(url), " ", "-", -1)))
}
func AbsUrl(url string, base string) template.HTML {
if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
return template.HTML(url)
}
return template.HTML(MakePermalink(base, url))
}
func Gt(a interface{}, b interface{}) bool {
var left, right int64
av := reflect.ValueOf(a)