0

I think I might be missing something here but it seems twig tags aren't parsed within tags? Is there any way they can be, e.g.:

<script>
var homepageStandfirstAnchors = [<% for anchor in homepage.homepageStandfirstAnchors %>[{{ anchor.text }},{{ anchor.section.handle }},{{ anchor.anchorLink }}],<% endfor %>];
</script>

doesn't work as expected.

  • My bad - should have been {% not <% – Daniel Sep 25 '14 at 10:56
1

It appears to be due to the angle brackets. Try:

<script>
    var homepageStandfirstAnchors = [{% for anchor in homepage.homepageStandfirstAnchors %}[{{ anchor.text }},{{ anchor.section.handle }},{{ anchor.anchorLink }}],{% endfor %}];
</script>
  • DUH whoops. I'll delete this question but thanks! – Daniel Sep 25 '14 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.