Sorry, I do not have the vocabulary to describe (or search for) this properly:
I have a string variable $command
with a value like for instance .IsHome
. Is there ANY way in gotemplates to transform it into its variable equivalent inside of a template?
For instance:
{{ $variable := ".IsHome" }}
{{ range $pages }}
{{ $$variable }} <-- echoes the value of .IsHome inside of the current page object
{{ end }}
In PHP I think that’s called a variable variable. You define the variablename with $variable
and get the variable with that name using $$variable
.
Is that possible within Hugo (or Go itself)?