diff --git a/layouts/_default/stats.html b/layouts/_default/stats.html index 4cc9677..7dd3f6a 100644 --- a/layouts/_default/stats.html +++ b/layouts/_default/stats.html @@ -9,10 +9,9 @@ {{ $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 }} @@ -21,11 +20,6 @@ {{ $scratch.Set "longestPost" . }} {{ $scratch.Set "longCount" .WordCount }} {{ end }} - - {{ if le .WordCount ($scratch.Get "shortCount") }} - {{ $scratch.Set "shortestPost" . }} - {{ $scratch.Set "shortCount" .WordCount }} - {{ end }} {{ end }} @@ -35,8 +29,15 @@ {{ $avgPostLength := div $wordCount $postCount }}
Total Posts Published | -{{ $postCount | lang.NumFmt 0 }} | + {{ range last 1 $posts }} + {{ $numYears := div (sub now.Unix .Date.Unix) 31536000 }} +Years Blogging | +{{ $numYears | lang.NumFmt 0 }} | + {{ end }} +
Total Posts Published | +{{ $postCount | lang.NumFmt 0 }} | ||
Total Words Written | @@ -66,14 +67,6 @@ {{ end }}|||
Shortest Post Published | -- {{ with $scratch.Get "shortestPost" }} - {{ .Title }} with {{ .WordCount }} words - {{ end }} - | -