internal/publisher/mux.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | package publisher
import (
"net/http"
ihttp "alin.ovh/homestead/internal/http"
pubtpl "alin.ovh/homestead/internal/publisher/templates"
"alin.ovh/homestead/templates"
)
func (app *App) Index(w http.ResponseWriter, _ *http.Request) *ihttp.Error {
err := pubtpl.IndexPage(app.siteSettings, templates.PageSettings{
Title: "Home",
}).Render(w)
if err != nil {
return &ihttp.Error{
Code: http.StatusInternalServerError,
Message: "Failed to render index page",
}
}
return nil
}
func (app *App) Style(w http.ResponseWriter, r *http.Request) *ihttp.Error {
w.Header().Set("Content-Type", "text/css")
http.ServeFileFS(w, r, templates.Files, "style.css")
return nil
}
|