{{ define "main" }} {{ partial "header.html" . }}
{{ .Content }} {{ $tags := .Site.Taxonomies.tags }} {{ $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 }} {{ $mostPopularTag := index .Site.Taxonomies.tags.ByCount 0 }} {{ $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 }}
Number of Topics {{ len $tags | lang.NumFmt 0 }}
Most Popular Topic {{ with $mostPopularTag }} {{ .Page.Title }} with {{ .Count }} posts {{ end }}
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" }}
{{ partial "footer.html" . }} {{ end }}