mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 07:46:30 -05:00
Removed shortest post from stats added year count
This commit is contained in:
parent
5a3139fbc4
commit
5e60c49e0b
1 changed files with 10 additions and 17 deletions
|
@ -9,10 +9,9 @@
|
||||||
{{ $posts := where site.RegularPages "Type" "blog" }}
|
{{ $posts := where site.RegularPages "Type" "blog" }}
|
||||||
|
|
||||||
{{ $postCount := len $posts }}
|
{{ $postCount := len $posts }}
|
||||||
|
|
||||||
{{ $scratch := newScratch }}
|
{{ $scratch := newScratch }}
|
||||||
{{ $scratch.Set "longCount" 0 }}
|
{{ $scratch.Set "longCount" 0 }}
|
||||||
{{ $scratch.Set "shortCount" 9999999999 }}
|
|
||||||
{{ range $posts }}
|
{{ range $posts }}
|
||||||
<!-- Sum words for average calculation later -->
|
<!-- Sum words for average calculation later -->
|
||||||
{{ $scratch.Add "wordcount" .WordCount }}
|
{{ $scratch.Add "wordcount" .WordCount }}
|
||||||
|
@ -21,11 +20,6 @@
|
||||||
{{ $scratch.Set "longestPost" . }}
|
{{ $scratch.Set "longestPost" . }}
|
||||||
{{ $scratch.Set "longCount" .WordCount }}
|
{{ $scratch.Set "longCount" .WordCount }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<!-- Find shortest post -->
|
|
||||||
{{ if le .WordCount ($scratch.Get "shortCount") }}
|
|
||||||
{{ $scratch.Set "shortestPost" . }}
|
|
||||||
{{ $scratch.Set "shortCount" .WordCount }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- Most Popular tag -->
|
<!-- Most Popular tag -->
|
||||||
|
@ -35,8 +29,15 @@
|
||||||
{{ $avgPostLength := div $wordCount $postCount }}
|
{{ $avgPostLength := div $wordCount $postCount }}
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="40%">Total Posts Published</td>
|
{{ range last 1 $posts }}
|
||||||
<td width="60%">{{ $postCount | lang.NumFmt 0 }}</td>
|
{{ $numYears := div (sub now.Unix .Date.Unix) 31536000 }}
|
||||||
|
<td width="40%">Years Blogging</td>
|
||||||
|
<td width="60%">{{ $numYears | lang.NumFmt 0 }}</td>
|
||||||
|
{{ end }}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Posts Published</td>
|
||||||
|
<td>{{ $postCount | lang.NumFmt 0 }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total Words Written</td>
|
<td>Total Words Written</td>
|
||||||
|
@ -66,14 +67,6 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Shortest Post Published</td>
|
|
||||||
<td>
|
|
||||||
{{ with $scratch.Get "shortestPost" }}
|
|
||||||
<a href="{{ .Permalink }}">{{ .Title }}</a> with {{ .WordCount }} words
|
|
||||||
{{ end }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{{ $grouped := $posts.GroupByDate "2006" }}
|
{{ $grouped := $posts.GroupByDate "2006" }}
|
||||||
|
|
Loading…
Reference in a new issue