mirror of
https://github.com/Kugelschieber/marvinblum.git
synced 2026-01-18 06:40:27 +00:00
Added experimental version of pirsch for server side tracking.
This commit is contained in:
@@ -3,6 +3,7 @@ package tpl
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/emvi/logbuch"
|
||||
"github.com/emvi/pirsch"
|
||||
"github.com/gosimple/slug"
|
||||
"html/template"
|
||||
"net/http"
|
||||
@@ -55,11 +56,13 @@ func Get() *template.Template {
|
||||
return tpl
|
||||
}
|
||||
|
||||
func ServeTemplate(name string) http.HandlerFunc {
|
||||
func ServeTemplate(name string, tracker *pirsch.Tracker) http.HandlerFunc {
|
||||
// render once so we have it in cache
|
||||
renderTemplate(name)
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tracker.Hit(r)
|
||||
|
||||
if hotReload {
|
||||
LoadTemplate()
|
||||
renderTemplate(name)
|
||||
|
||||
Reference in New Issue
Block a user