easierbycode
2/25/2010 - 11:17 PM

liquid_post_counts.liquid

# Provides a category link with a count of the number of posts in
<ul>
  {% for category in site.categories %}
    <li id="{{ category[0] | downcase | replace:' ', '-' }}"><a href="/{{ category[0] }}/">{{category[0] | capitalize }}</a> <span>{{ category[1] | size }}</span></li>     
  {% endfor %}
</ul>

# .. and the same for tags
<dl>
{% for tag in site.tags  %}
  <dt id='{{ tag[0] | downcase | replace:' ', '-' }}'>{{tag[0]}}  ({{tag[1] | size }})</dt>
    {% for post in tag[1] %}
      <dd><a href="{{ post.url }}/">{{ post.title }}</a></dd>
    {% endfor %}
{% endfor %}
</dl>