blog/static/static.go

32 lines
588 B
Go

package static
import (
_ "embed"
"html/template"
"net/http"
"github.com/rs/zerolog/log"
)
//go:embed sakura.css
var sakuraCSS []byte
func SakuraCSS(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/css")
if _, err := w.Write(sakuraCSS); err != nil {
log.Error().Err(err).Msg("could not write sakura.css")
}
}
var (
//go:embed post.tmpl
postTmpl string
PostTemplate = template.Must(template.New("").Parse(postTmpl))
)
var (
//go:embed index.tmpl
indexTmpl string
IndexTemplate = template.Must(template.New("").Parse(indexTmpl))
)