I have several pages with Go html templates (without any parameters sent from Go).
The main template should send 2 string parameters to next template.
{{template "httpend" "main" "sub"}}
The other template with a script should be able to receive these parameter and fire a Javascript function.
{{define "httpend"}}
<script src="/js/menu.js" defer></script>
<script src="/js/nav.js" defer></script>
<script>
window.onload = function() {
fillsubmenu({{.}},{{.}})
}
</script>
{{end}}
The purpose of this is to make it more DRY. Repeating the script on every page is harder to maintain.
There are NO dots parameters sent from Go. (.main .sub). Just plain strings…
No errors reported, but the httpend template will not show up for some reason. And hence not fired.
How can I send multiple strings as parameters to another Go html template?