Using a for loop's current index as an argument in a tag

57 views
Skip to first unread message

Tom Preston-Werner

unread,
Jun 21, 2010, 9:26:58 PM6/21/10
to Liquid Templates
Is it possible to use the currently indexed variable in a for loop as
an argument to a tag? Something like this:

{% for entry in entries %}
{% include entry %}
{% endfor %}

Where `include` is a custom tag and `entry` is the variable from the
for loop and not the literal string "entry".

Thanks!

Tom

--
Tom Preston-Werner
GitHub Cofounder
http://tom.preston-werner.com
github.com/mojombo

Alexandre Rademaker

unread,
Dec 5, 2011, 1:59:01 PM12/5/11
to liquid-t...@googlegroups.com
Hello Tom,

Have you gotten any answer for this question? I am using Jekyll. I want to have in my pages, a YAML metadata with a list of boxes that should appear in the right column (http://emap.fgv.br). Each box will be an HTML file in the _includes directory. That is, my problem is the same pointed by you. I want to interact over a loop var doing includes.

Cheers,
Alexandre
Reply all
Reply to author
Forward
0 new messages