Reputation: 529
I'm having a problem controlling the appearance of my site's tags when using a for loop to render out all tags
in site.tags
.
This is what I am intending:
<li class="sliced-almonds">sliced almonds</li>
And this is what I have:
{% for tag in site.tags %}
<li class="{{ tag | handleize | replace:' ','-' }}">{{ tag }}</li>
{% endfor %}
But instead I get this:
<li class="[" sliced-almonds",-[<post:-="" salads="" salad-04="">]]">sliced almonds</li>
Upvotes: 4
Views: 1351
Reputation: 529
Just figured it out. When using grabbing tags from site.tags
, tag[0]
is the name and tag[1]
are all of the posts associated with that tag.
<ul>
{% for tag in site.tags %}
<li class="{{ tag[0] | replace:' ','-' }}">{{ tag }}</li>
{% endfor %}
</ul>
Upvotes: 5