Spicing up blog list and tag list pages

This commit is contained in:
Brandon Rozek 2022-11-23 00:56:13 -05:00
parent 89aade301c
commit 4d5f0f30cb
7 changed files with 83 additions and 20 deletions

View file

@ -28,7 +28,17 @@
{{ end }}
<p class="bloglist-date">{{ .Key }}</p>
{{ range .Pages }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
<div class="bloglist-item">
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
<p class="bloglist-item-tag">
{{ range .Params.tags }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" (. | urlize)) }}
<span><a href="{{ .Permalink }}">#{{ $name }}</a> </span>
{{ end }}
{{ end }}
</p>
</div>
{{ end }}
{{ end }}
</div>

View file

@ -1,5 +1,5 @@
<!-- tags -->
<details id="tags">
<details class="tags tags-all">
<summary>Tags</summary>
<ul>
{{ range .Site.Taxonomies.tags.ByCount }}

View file

@ -1,5 +1,5 @@
<!-- List the tags that apply to this page -->
<div id="tags">
<div class="tags tags-page">
<ul>
{{ range .Param "tags" }}
{{ $name := . }}

View file

@ -1,14 +1,16 @@
{{ define "main"}}
{{ partial "header.html" . }}
<main>
{{ partial "search.html" . }}
{{ partial "tags/all.html" . }}
<div class='bloglist-teaser' style="margin-top: 2rem;">
Here you'll find <strong>{{ len .Pages | lang.NumFmt 0 }} posts</strong>
about <u>{{ .Title }}</u> </strong>.
</div>
<!-- contents -->
<div class="bloglist">
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}}
{{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }}
{{ if (ne $index 0) }}
<hr class="separator">
<br/>
{{ end }}
<p class="date">{{ .Key }}</p>
{{ range .Pages }}

View file

@ -18,7 +18,7 @@
</ul>
</div>
<!-- content -->
<div id="contentBody">
<div class="e-content">
{{ .Content }}
</div>
{{ partial "footer.html" . }}

View file

@ -1,7 +1,26 @@
{{ define "main"}}
{{ partial "header.html" . }}
<main>
{{ partial "tags/all.html" . }}
{{ $posts := where site.RegularPages "Type" "blog" }}
{{ $postCount := len $posts }}
{{ range last 1 $posts }}
{{ $tags := .Site.Taxonomies.tags }}
<div class='bloglist-teaser'>
Here you'll find <strong>{{ $postCount | lang.NumFmt 0 }} posts</strong>
written spanning <strong>{{ len $tags }} topics</strong>.
</div>
{{ end }}
<br/>
<div class="tags tags-all">
<ul>
{{ range .Site.Taxonomies.tags.ByCount }}
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }} ({{ .Count }})</a></li>
{{ end }}
</ul>
</div>
<div class="e-content">
{{ .Content }}
</div>
</main>
{{ partial "footer.html" . }}
{{ end }}