9c24b30262
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
21 lines
391 B
Go
21 lines
391 B
Go
package handler
|
|
|
|
import (
|
|
"html/template"
|
|
"io"
|
|
"log"
|
|
)
|
|
|
|
type Templates struct {
|
|
tmpl *template.Template
|
|
}
|
|
|
|
func NewTemplates(tmpl *template.Template) *Templates {
|
|
return &Templates{tmpl: tmpl}
|
|
}
|
|
func (t *Templates) Render(w io.Writer, name string, data any) {
|
|
if err := t.tmpl.ExecuteTemplate(w, name+".html", data); err != nil {
|
|
log.Printf("template error: %s: %v", name, err)
|
|
}
|
|
}
|