Hello, let’s say I have a lot of json data files with lyrics, which is categorized as such:
- data > artists > {artist_name} > songs > {song_name}.json
In my Content markdown files then I have parameters for {artist_name} and an array of song names.
My question is, how can I call {{ .Site.Data.artists.$artist_name.songs.$song_name }}?
I’ve tried to use e.g.
{{ range .Params.songs }}
{{ filename := printf ".Site.Data.artists.%s.songs.%s" .Params.artist . }}
{{ end }}
Which gets the right path, but I’m unable to use the string to get the json data… it also seems it’s impossible to say, e.g. {{ .Site.Data “artists.adele.songs.someonelikeyou” }}.
The only way I can think of that might work is range over everything for both artist and song and check if the json field match the param, but that sounds extremely inefficient.
Any help would be much appreciated