This may seem like an easy question, but I’ve been fighting it for a couple of days. I have a section labelled “music” that basically is a set of blog posts containing mp3 files from performances by our local community band. In the past, it was a simple HTML file, but I’d like to do it properly. I tried adding it to my front matter like:
[[params.music]]
url = "hugo.mp3"
name = “The Hugo Song”
[[params.music]]
url = "html.mp3"
name = “The HTML Song”
But I couldn’t parse that. I could put the TOML in a data file, but how can I specify that particular data file dynamically with the single.html template in the music layout folder? I’d have about 100 separate data files + 100 posts. That’s why I’d like to put it into the frontmatter if possible.
What’s the error message that you got? The issue that that pull request fixes is about a TOML array not parsed and turning up empty (without an error message). Perhaps the error message you got can help troubleshoot this issue.
I originally had the data in toml just like the menu structure, but it just rendered blank lines or errored out… That’s when I swapped over to YAML because it was noted in the past that this was supposed to work…
The line number of that error is the {{ range… line. Not much about the error. When I print the page params, all the data shows up, so it is read successfully…
Here is the printf of the .Params:
map[string]interface {}{“playlist”:interface {}{map[interface {}]interface {}{“songs”:interface {}{map[interface {}]interface {}{“title”:“Big Band Signatures”, “url”:“bigbandsignatures.mp3”}, map[interface {}]interface {}{“title”:“Florentiner March”, “url”:“florentiner.mp3”}, map[interface {}]interface {}{“title”:“New Colonial March”, “url”:“newcolonial.mp3”}, map[interface {}]interface {}{“url”:“starsandstripes.mp3”, “title”:“Stars and Stripes Forever”}, map[interface {}]interface {}{“title”:“Symphonic Dances from Fiddler on the Roof”, “url”:“symphonicdances.mp3”}, map[interface {}]interface {}{“title”:“The Prayer”, “url”:“theprayer.mp3”}, map[interface {}]interface {}{“title”:“The Saints”, “url”:“thesaints.mp3”}, map[interface {}]interface {}{“url”:“tiptoe.mp3”, “title”:“Tiptoe through the Tubas”}}}}, “categories”:string{“music”}, “tags”:string{“Comal Community Band”}, “music”:“Comal Community Band”}
I actually didn’t have the dots in those lines… I had that when I was trying to fake indent on this site until I discovered that the four spaces indented code…