Working with layouts

This commit is contained in:
Muyao CHEN
2024-06-26 22:25:04 +02:00
parent 144e700b15
commit 10d4172f3c
4 changed files with 43 additions and 45 deletions

View File

@ -8,7 +8,7 @@ import (
// renderTemplate renders a HTML template file
func RenderTemplate(w http.ResponseWriter, tmpl string) {
parsedTemplate, _ := template.ParseFiles("./templates/" + tmpl)
parsedTemplate, _ := template.ParseFiles("./templates/"+tmpl, "./templates/base.layout.tmpl")
err := parsedTemplate.Execute(w, nil)
if err != nil {
fmt.Println("error parsing template:", err)