How to insert sub-templates?
Closed this issue · 2 comments
Hello Joseph,
This may sound stupid question , but I was unable to insert an iconbar
sub-template into my content
template. What I want to achieve is that each article on the page (content area) has an iconbar snippet below it like this:
{{define "content"}} {{range $n := .articles}} {{$n.Name}} {{template "iconbar" .}} {{end}} {{end}}
I defined iconbar.tmpl
inside /template/partial
folder, and inserted {{template "iconbar" .}}
, but at runtime I get:
Template File Error: html/template:articles.tmpl:56:14: no such template "iconbar".
I also tried other tricks to insert iconbar
in base.tmpl but all failed.
So I'm clueless and appreciate your help.
Thanks in advance.
Try adding the template to the Children key in the config.json: https://github.com/josephspurrier/gowebapp/blob/master/config/config.json#L54
Thanks for the tip. Never saw that config. Shame on me!