Updating theme to include tag counts and description on blog page

This commit is contained in:
Brandon Rozek 2022-11-22 19:06:34 -05:00
parent 8982737cbc
commit 1f1e07b4bf
2 changed files with 20 additions and 0 deletions

View file

@ -5,6 +5,7 @@
<article class="row justify-content-center"> <article class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-8">
{{ .Content }} {{ .Content }}
{{ $tags := .Site.Taxonomies.tags }}
{{ $posts := where site.RegularPages "Type" "blog" }} {{ $posts := where site.RegularPages "Type" "blog" }}
{{ $postCount := len $posts }} {{ $postCount := len $posts }}
@ -42,6 +43,10 @@
<td>Average Words per Post</td> <td>Average Words per Post</td>
<td>{{ $avgPostLength | lang.NumFmt 0 }}</td> <td>{{ $avgPostLength | lang.NumFmt 0 }}</td>
</tr> </tr>
<tr>
<td>Number of Topics</td>
<td>{{ len $tags | lang.NumFmt 0 }}</td>
</tr>
<tr> <tr>
<td>Longest Post Published</td> <td>Longest Post Published</td>
<td> <td>

View file

@ -3,6 +3,21 @@
<main> <main>
{{ partial "search.html" . }} {{ partial "search.html" . }}
{{ partial "tags/all.html" . }} {{ partial "tags/all.html" . }}
<br/>
{{ $posts := where site.RegularPages "Type" "blog" }}
{{ $postCount := len $posts }}
{{ range last 1 $posts }}
{{ $tags := .Site.Taxonomies.tags }}
<div style="font-size: 1.5rem; max-width: 30rem; margin-left: auto; margin-right: auto;">
Hello! This page contains <strong>{{ $postCount | lang.NumFmt 0 }} posts</strong>
written in the past <strong>{{ div (sub now.Unix .Date.Unix) 31536000 }} years</strong>
spanning {{ len $tags }} topics within the dropdown above.
</div>
{{ end }}
<!-- contents --> <!-- contents -->
<div id="contentsList"> <div id="contentsList">
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}} {{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}}