How to call a variable inside a Nested Template Definition

I’ve use Go Nested Template Definitions —instead of config.toml global Params— because I find them easier to work with, and because I’ve been trying to use Hugo MultiSite (but that’s a different story).

Nested Template Definition are (from the Go website)…

The define action names the template being created by providing a string constant. Here is a simple example:

{{define “T1”}}ONE{{end}}
{{define “T2”}}TWO{{end}}
{{define “T3”}}{{template “T1”}} {{template “T2”}}{{end}}
{{template “T3”}}`
This defines two templates, T1 and T2, and a third T3 that invokes the other two when it is executed. Finally it invokes T3. If executed this template will produce the text


Does anyone know if or how I can call a variable into a template? Like so…

{{ $title := (.Title) }}
{{template $title }}