I have the following code in my template:
{% for post in site.posts %}
{% capture num_colors %}{{ site.colors | size }}{% endcapture %}
{% capture color_index %}{{ forloop.index0 | mod: num_colors }}{% endcapture %}
<a href="{{ post.url }}" class="post-box" rel="bookmark" title="{{ post.title }}">
<div class="post-block {{ site.colors[color_index] }}">
<div class="contents">
<div class="cat-tag">
{{ post.categories[0] | upcase }}
</div>
<h2>{{ post.title }}</h2>
</div>
</div>
</a>
{% endfor %}
This keeps retuing nothing: {{ site.colors[color_index] }} even though num_colors, color_index, and site.colors will all retu the correct things when I try and print them.
colors is defined in my _config.yml as:
colors: [light_blue, coral, yellow, teal, blue, deep_blue]
I'm using a plugin to get modulus. Basically I just want to attach a class for each post that will start over when its gone beyond the total number of colors. This seems straightforward so I'm confused.
