In params I have something like this (adjusted for brevity)…
[[childdatal]]
name = "sitedata1"
file = "site.Data.file1.items"
[[childata]]
name = "sitedata2"
file = "site.Data.file2.items"
Now I want to dynamically append these into a combined object to iterate and render Which I have in my list.html page, something like this…
{{ $merged := slice }}
{{ range $childdata }}
{{ $file := .file }}
{{ $merged = $merged | append $file }}
# //Render combined json data here
#{{ $file }}
{{ end }}
In the resulting function if I uncomment {{ $file }}
I see the correct list of file references.
If I hard code {{ $merged = $merged | append site.Data.file1.items }}
I get the correct unpacking of the underlying json, but otherwise it treats $file as a variable representing a string.
What needs to happen to treat $file
as a reference to the json (as when its hard-coded) instead of string?
Many Thanks
Mark