String interpolation with range

I’m adding a new layout “foo” which for every content whose type is “foo”, it has a linked data file. However, on writing the layout I need to access the linked data using a parameter defined in the front matter, but Hugo refuses to range over the relative path I’ve made using string interpolation:

{{ if .Params.name }}
              <!-- Gets the 'name' attr and looks for it in the 'data' folder -->
              {{ $path := Sprintf "$.Site.Data.%s.items" .Params.name }}
              {{ range $path }}

Is there any way that I can do string interpolation on relative paths and get it working for range?