title: How to list page categories and corresponding post count in jekyll
body: <p>In my jekyll site I have 3 categories in a post. I want to show badges for each category and their post count. I used </p>
  
  <pre><code>{% for category in page.categories %}
  {% unless category == 'index'%}
  &lt;a href="/cat/{{category}}"&gt;{{category}}{{category.size}}&lt;/a&gt;
  {% endunless %}
  {% endfor %}
  </code></pre>
  
  <p>in post layout.
  This works,  but post count shows wrong number. I also tried without <code>unless</code> statement but not works.</p>