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.

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

1 Answer 1

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>
1
  • DUH whoops. I'll delete this question but thanks!
    – Daniel
    Commented Sep 25, 2014 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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