Counting collection tags in Jekyll
<p>I am trying to count and list the tags inside a Collection called <code>_note</code> in Jekyll. I'm extremely close, I think, to solving it, but I'm getting a little tripped up on the actual counting of the tags (listing unique tags works fine) and could use a second pair of eyes to look at the liquid markup and see what I'm missing.  </p>

<p>Tags in the <code>_note</code> YAML header are organized as:</p>

<p><code>tags: [tag1, tag2, tag3, tag4]</code></p>

<p>Thus far:</p>

<pre><code>&lt;!-- Create empty arrays --&gt;
{% assign tags = '' | split: ',' %}
{% assign unique_tags = '' | split: ',' %}
{% assign counter = 0 %}

&lt;!-- Map and flatten --&gt;
{% assign note_tags =  site.note | map: 'tags' | join: ','  | split: ',' %}

&lt;!-- Push to tags --&gt;
{% for tag in note_tags '%}
  {% assign tags = tags | push: tag %}
{% endfor %}

&lt;!-- Uniq --&gt;
{% assign tags = tags | sort %}
{% for tag in tags %}
  &lt;!-- If not equal to previous then it must be unique --&gt;
  {% unless tag == previous %}    
    &lt;!-- Push to unique_tags and count --&gt;
    {% assign unique_tags = unique_tags | push: tag %}
    {% assign counter = counter | plus: 1 %}
  {% endunless %}
  {% assign previous = tag %}
{% endfor %}

{% for tag in unique_tags %}
  {{ tag }} ({{ counter }}
{% endfor %}
</code></pre>

<p>Using the <code>size</code> method in liquid doesn't seem to return the correct value.</p>