Fix blank page: URL types and inline style issues in templates
Build and Deploy / build-and-deploy (push) Successful in 1m3s
Build and Deploy / build-and-deploy (push) Successful in 1m3s
- Use template.URL for all URLs passed to templates (RSSURL, ImageURL) - Pre-compute episode image URLs in handler as safe types - Remove all inline style attributes, use CSS classes instead - Add template error logging to catch silent failures - HTML/template rejects raw strings in URL and CSS+URL contexts
This commit is contained in:
+4
-2
@@ -3,6 +3,7 @@ package handler
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Templates struct {
|
||||
@@ -12,7 +13,8 @@ type Templates struct {
|
||||
func NewTemplates(tmpl *template.Template) *Templates {
|
||||
return &Templates{tmpl: tmpl}
|
||||
}
|
||||
|
||||
func (t *Templates) Render(w io.Writer, name string, data any) {
|
||||
_ = t.tmpl.ExecuteTemplate(w, name+".html", data)
|
||||
if err := t.tmpl.ExecuteTemplate(w, name+".html", data); err != nil {
|
||||
log.Printf("template error: %s: %v", name, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user