add nocache template func

This commit is contained in:
sentriz
2020-03-12 00:59:56 +00:00
parent eec0b0bf1f
commit a3fce34cba
3 changed files with 28 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ import (
"html/template"
"log"
"net/http"
"net/url"
"path/filepath"
"strings"
"time"
@@ -83,6 +84,13 @@ func New(base *ctrlbase.Controller) *Controller {
"date": func(in time.Time) string {
return strings.ToLower(in.Format("Jan 02, 2006"))
},
"noCache": func(in string) string {
parsed, _ := url.Parse(in)
params := parsed.Query()
params.Set("v", version.VERSION)
parsed.RawQuery = params.Encode()
return parsed.String()
},
"dateHuman": humanize.Time,
"path": base.Path,
})