package main import ( "html/template" "net/http" "time" ) type IndexPage struct { BookTitle string Timestamp string } func index(w http.ResponseWriter, r *http.Request) { page := template.Must(template.New("index").Parse(indexPage)) deadline := time.Date(2024, 12, 1, 0, 0, 0, 0, time.UTC) timeRemaining := deadline.Sub(time.Now().Round(24 * time.Hour)) book, timestamp := getBookWithTimestamp(timeRemaining) data := IndexPage{ BookTitle: book, Timestamp: timestamp.String(), } page.Execute(w, data) } const indexPage string = ` Stormlight Archive Tracker

Stormlight Archive Tracker

You should be reading {{.BookTitle}} and be past the {{.Timestamp}} mark by the end of the day.

`