I'm trying to get into web-development in Go, and so far I've figured out to nest templates and passing in variables. But is there a way to reuse templates? I'm thinking along the lines of creating a new template from an existing one, and passing in variables unique for each.
Take for instance this template:
{{define "btn"}}
<button type={{.Type}} class={{.Class}} title={{.Title}}>
{{.Name}}
</button>
{{end}}
Would the be a way to create new static templates from "btn", and use them somewhat like this:
<html>
<head>
<title>My page</title>
</head>
<body>
<h1>A button</h1>
<div>{{template "btn-version-1"}}</div>
</div>
<h2>Another button</h2>
<div>Some content {{template "btn-version-2"}}</div>
</body>
</html>
But I feel that I'm barking up the wrong tree.