From b8b6d3037c524575f140650ac243c16df6a98a92 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Wed, 19 Jul 2023 21:01:49 +0200 Subject: feat: Move last page to qtpl --- static.go | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'static.go') diff --git a/static.go b/static.go index 1c6a086..06f1459 100644 --- a/static.go +++ b/static.go @@ -2,33 +2,9 @@ package img import ( "embed" - "fmt" - "html/template" - "io" ) var ( - //go:embed templates/*.html - TemplateFS embed.FS - //go:embed static/* StaticFS embed.FS - - Template *template.Template ) - -type HTMLView[T any] struct { - Title string - Username string - Data T -} - -func Render[T any](w io.Writer, page string, view *HTMLView[T]) error { - pageFile := fmt.Sprintf("templates/%s", page) - tmpl, err := template.New("").ParseFS(TemplateFS, "templates/layout.html", pageFile) - if err != nil { - return err - } - - return tmpl.ExecuteTemplate(w, page, view) -} -- cgit v1.2.3