3
votes

In each of my Jekyll posts, I have a number listed in the front matter:

---
minutes: X
---

The value is always different from post-to-post and I would like to find the sum of all the posts.

Not sure if this is possible or what the approach should be.

Thanks for any help in advance!

1

1 Answers

8
votes

Try:

{% assign total = 0 %}
{% for post in site.posts %}
  {% assign total = total | plus: post.minutes %}
{% endfor %}
{{ total }}