Closed jsgv closed 5 years ago
I noticed that I can't define more than one template, which kinda defeats what I'm trying to achieve.
index.tmpl
{{define "footer_extra"}}
<!-- scripts just for this page -->
<script src="script-1.js"></script>
<script src="script-2.js"></script>
{{end}}
new.tmpl
{{define "footer_extra"}}
<!-- scripts just for this page -->
<script src="script-3.js"></script>
<script src="script-4.js"></script>
{{end}}
layout.tmpl
<script src="main.js"></script>
{{template "footer_extra"}}
will throw a PANIC
template: redefinition of template "footer_extra"
@jesusjjf Was this ever resolved?
I am trying to define code blocks that will get injected in the base template if they are defined. I don't want to include all the scripts that are required on one page onto another that doesn't require it.
Basically what im trying to do is something like:
on the layout:
admin.tmpl
:and on
new.tmpl
:Not sure if this is something i could just achieve with Go, kinda new to the language. Thanks!