diff options
| author | Mikkel Thestrup <mikkel_thestrup@mithe.dk> | 2025-12-06 19:21:55 +0100 |
|---|---|---|
| committer | Mikkel Thestrup <mikkel_thestrup@mithe.dk> | 2025-12-06 19:21:55 +0100 |
| commit | b668f82b3bb834265c842bff96c252a513afa647 (patch) | |
| tree | 49286ab3ef556758a6620378e1aa01fd5de59f02 /internal/template.go | |
| download | web-portfolio-b668f82b3bb834265c842bff96c252a513afa647.tar.gz web-portfolio-b668f82b3bb834265c842bff96c252a513afa647.zip | |
Initial commit
Diffstat (limited to 'internal/template.go')
| -rw-r--r-- | internal/template.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/template.go b/internal/template.go new file mode 100644 index 0000000..3d2fe4b --- /dev/null +++ b/internal/template.go @@ -0,0 +1,34 @@ +package internal + +import ( + "html/template" + "io" + + "github.com/labstack/echo/v4" +) + +type PageData struct { + Content template.HTML + Page string + Pages []string + Sections []string +} + +type SectionData struct { + Content template.HTML + Page string + Sections []string +} + +type TemplateRenderer struct { + Template *template.Template +} + +func (t *TemplateRenderer) Render( + w io.Writer, + name string, + data interface{}, + c echo.Context, +) error { + return t.Template.ExecuteTemplate(w, name, data) +} |