Embed the index template
parent
c4a0886187
commit
cd2e128001
|
@ -1,12 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed index.html
|
||||||
|
var indexTemplate string
|
||||||
|
|
||||||
type TemplateQuay struct {
|
type TemplateQuay struct {
|
||||||
Name string
|
Name string
|
||||||
Town string
|
Town string
|
||||||
|
@ -48,7 +52,7 @@ func handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tpl := template.New("index.html").Funcs(tplFunctions)
|
tpl := template.New("index.html").Funcs(tplFunctions)
|
||||||
tpl, _ = tpl.ParseFiles("index.html")
|
tpl, _ = tpl.Parse(indexTemplate)
|
||||||
|
|
||||||
_ = tpl.Execute(w, ctxt)
|
_ = tpl.Execute(w, ctxt)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue