diff --git a/main.go b/main.go index 220dcd3..afe8a64 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "strings" + "time" "golang.org/x/crypto/acme/autocert" ) @@ -37,7 +38,12 @@ func Main() { var err error // Initialize globals. - tmpl = template.Must(template.New("").Parse(tmpls)) + tmpl = template.Must(template.New("").Funcs(template.FuncMap{ + "now": func() string { + return time.Now().UTC().Format("2006-01-02 15:04") + }, + }).Parse(tmpls)) + if db, err = newDB("database.sqlite3"); err != nil { os.Exit(1) } diff --git a/templates/base.html b/templates/base.html index dbc1117..5fc6ea0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,7 +11,9 @@
  • Log
  • Sources
  • Users
  • +
  • {{now}}
  • + {{end}} {{define "PageEnd" -}} diff --git a/tmpl_gen.go b/tmpl_gen.go index 8eec01d..d42fb5d 100644 --- a/tmpl_gen.go +++ b/tmpl_gen.go @@ -14,6 +14,7 @@ var tmpls = `
  • Log
  • Sources
  • Users
  • +
  • {{now}}
  • {{end}}