In a Grav template, which uses Twig, I have
<audio controls>
<source src="{{ page.find('/mp3s').media['{{ page.header.samplename }}.mp3'] }}">
</audio>
Nothing is rendered and when I do View Source, what I see is
<audio controls>
<source src="">
</audio>
I know that page.header.samplename
contains a valid name of an MP3 file. And if I replace {{ page.header.samplename }}
with the explicit name of an MP3 file, the code works. So I must have a syntax error. I have tried various perms and have also searched Stack Overflow.
What should the code be?