I'm working on jekyll theme design and I have .yml file stored the data (File name : games.yml) and has data as follows
---
- name: NFS
year: 2015
id: NFS15
link: http://www.ecample.com/
date: August 3-4, 2017
categories: Racing
etc
I'm trying to output the categories in sidebar with number of count in each category. e.g:
Racing (3)
Shooter (6)
Sports (5)
etc
How can I achieve this?
My HTML output code:
<a href="javascript:;" class="categories-list-item" cate="All">
All<span class="my-badge"> {{site.data.games | size}}</span>
</a>
{% for cat in site.data.games %}
<a href="javascript:;" class="categories-list-item" cate="{{ cat.categories}}">
{{ cat.categories }} <span class="my-badge">{{ cat.categories | size }}</span>
</a>
{% endfor %}
Now I get the result with entire category list e.g:
Racing
Racing
Racing
Shooter
Shooter
Shooter...
and so on each count