diff --git a/main.go b/main.go index 4d78fdf..f1b1f70 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "embed" "fmt" "log" "net/http" @@ -11,11 +12,14 @@ import ( "git.valxntine.dev/valxntine/blog/templates" ) +//go:embed static/* +var staticFS embed.FS + func main() { mux := http.NewServeMux() - fs := http.FileServer(http.Dir("./static/")) - mux.Handle("/static/", http.StripPrefix("/static/", fs)) + staticHandler := http.FileServer(http.FS(staticFS)) + mux.Handle("/static/", staticHandler) mux.HandleFunc("/", handleHome) mux.HandleFunc("/posts/", handlePost) diff --git a/templates/layout.templ b/templates/layout.templ index 8f72790..715e6d3 100644 --- a/templates/layout.templ +++ b/templates/layout.templ @@ -13,13 +13,21 @@ templ Layout(title string) {
{ children... }