package pages import ( "html/template" "log" "github.com/labstack/echo/v4" "goth.stack/lib" ) type HomeProps struct { Socials []lib.IconLink Tech []lib.IconLink // Add more props here } func Home(c echo.Context) error { socials := []lib.IconLink{ { Name: "Email", Href: "mailto:me@atri.dad", Icon: template.HTML(``), }, { Name: "GitHub", Href: "https://github.com/atridadl/goth-stack", Icon: template.HTML(``), }, } tech := []lib.IconLink{ { Name: "Go", Href: "https://golang.org", Icon: template.HTML(`Go`), }, { Name: "Redis", Href: "https://redis.io", Icon: template.HTML(`Redis`), }, { Name: "Fly.io", Href: "https://fly.io", Icon: template.HTML(``), }, { Name: "Docker", Href: "https://docker.com", Icon: template.HTML(`Docker`), }, } props := HomeProps{ Socials: socials, Tech: tech, // Add more props here } templates := []string{ "./pages/templates/layouts/base.html", "./pages/templates/partials/header.html", "./pages/templates/partials/navitems.html", "./pages/templates/home.html", } ts, err := template.ParseFiles(templates...) if err != nil { log.Print(err.Error()) return err } return ts.ExecuteTemplate(c.Response().Writer, "base", props) }