As a test, does this work?
legend: '{{ site.title }}'
Not sure if it is related, but when I was using this feature I discovered the processing occurred before page processing so I could not access page-related items: Processing Twig in Page Frontmatter?