Jekyll Front Adder is a module to add up the values of specified hashes from a post's front matter and add a running total back to the post's front matter.
Add this line to your site's Gemfile:
gem 'jekyll-frontadder'
And then add this line to your site's _config.yml
:
gems:
- jekyll-frontadder
Add an entry similar to the following to your _config.yml
:
frontadder:
- hours
This will configure frontadder to look for a hash structure called 'hours' on your site's posts, similar to the following:
hours:
total: .5
part:
horizontal stabilizer: .5
type:
deburring: .5
When it finds this structure, it will add up all of the keys it finds. As each post is processed, a copy of the running totals will be left under ['hash']['runtotal'] for use on the page. After the plugin finishes, the site will have a hash entry with the totals for the entire site.