+
+ {{ .Content }}
+ {{ $posts := where site.RegularPages "Type" "blog" }}
+
+ {{ $postCount := len $posts }}
+
+ {{ $scratch := newScratch }}
+ {{ $scratch.Set "longCount" 0 }}
+ {{ $scratch.Set "shortCount" 9999999999 }}
+ {{ range $posts }}
+
+ {{ $scratch.Add "wordcount" .WordCount }}
+
+ {{ if ge .WordCount ($scratch.Get "longCount") }}
+ {{ $scratch.Set "longestPost" . }}
+ {{ $scratch.Set "longCount" .WordCount }}
+ {{ end }}
+
+ {{ if le .WordCount ($scratch.Get "shortCount") }}
+ {{ $scratch.Set "shortestPost" . }}
+ {{ $scratch.Set "shortCount" .WordCount }}
+ {{ end }}
+ {{ end }}
+
+ {{ $wordCount := $scratch.Get "wordcount" }}
+ {{ $avgPostLength := div $wordCount $postCount }}
+
+
+ Total Posts Published |
+ {{ $postCount | lang.NumFmt 0 }} |
+
+
+ Total Words Written |
+ {{ $wordCount | lang.NumFmt 0 }} |
+
+
+ Average Words per Post |
+ {{ $avgPostLength | lang.NumFmt 0 }} |
+
+
+ Longest Post Published |
+
+ {{ with $scratch.Get "longestPost" }}
+ {{ .Title }} with {{ .WordCount }} words
+ {{ end }}
+ |
+
+
+ Shortest Post Published |
+
+ {{ with $scratch.Get "shortestPost" }}
+ {{ .Title }} with {{ .WordCount }} words
+ {{ end }}
+ |
+
+
+
+ {{ $grouped := $posts.GroupByDate "2006" }}
+
+
Posts Per Year
+
+
+
+
+
+
+
+
+ {{ $chartPre := "{type: 'line',data: {labels: [" }}
+ {{ $chartYearKeys := trim ($scratch.Get "yearKeys") ","}}
+ {{ $chartYearCount := trim ($scratch.Get "yearCount") ","}}
+ {{ $chartMid := "],datasets: [{label: 'Posts Published',data: [" }}
+ {{ $chartPost := "],backgroundColor: 'rgb(54, 128, 56)',borderColor: 'rgb(54, 128, 56)',borderWidth: 3}]},options: {maintainAspectRatio: false, animation: false, scales: {y: {ticks: {beginAtZero: true}}}}}"
+ }}
+
+
+ {{ $chartData := printf "%s" $chartPost | printf "%s%s" $chartYearCount | printf "%s%s" $chartMid | printf "%s%s" $chartYearKeys | printf "%s%s" $chartPre | printf "%s" }}
+
+
+
+
+
+