-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.html
More file actions
33 lines (28 loc) · 1.04 KB
/
stats.html
File metadata and controls
33 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
layout: page
---
<h1>Stats</h1>
<p>As of {{ site.time | date: site.date_format }}, generated with Jekyll {{ jekyll.version }}.</p>
{% assign posts_by_year = site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
{% assign posts_by_year = posts_by_year | sort: "name" | reverse %}
{% assign total_words = 0 %}
{% for year_posts in posts_by_year %}
{% assign year_total = 0 %}
{% for post in year_posts.items %}
{% assign words = post.content | strip_html | number_of_words %}
{% assign year_total = year_total | plus: words %}
{% assign total_words = total_words | plus: words %}
{% endfor %}
<h2> {{ year_posts.name }}</h2>
<ul>
{% assign post_count = year_posts.items | size %}
<li>{{ year_total }} words ({{ year_total | divided_by: post_count }} average)</li>
<li>{{ post_count }} posts</li>
</ul>
{% endfor %}
<h2>Total</h2>
<ul>
{% assign post_count = site.posts | size %}
<li>{{ total_words }} words ({{ total_words | divided_by: post_count }} average)</li>
<li>{{ post_count }} posts</li>
</ul>