How to count the number of values in the YML using Liquid?

There is a YML file advertisers.yml.
It is necessary to count the number of campaigns with status = 1

- login: ivanivanov
 name: Ivan Ivanov
campaigns:
 - name: Campaign Ivan Ivanov
 status_id: 1
 - name: the Second campaign of Ivan Ivanov
 status_id: 2
- login: ivanpetrov
 name: Ivan Petrov
campaigns:
 - name: Campaign of Ivan Petrov
 status_id: 1
- login: ivansidorov
 name: Ivan Sidorov
campaigns:
 - name: Campaign Sidorova
 status_id: 3


Kind of like the code* should be:
{% assign advertiser = site.data.advertisers %}
{% assign campaign = advertiser.campaigns %}
{% if campaign.status_id == 1 %}
{{ campaign.status_id | size }}
{% endif %}

But it's not working

*Used Jekyll
September 18th 19 at 23:43
0 answer

Find more questions by tags YAMLRuby