Postroll feature

This commit is contained in:
Brandon Rozek 2024-12-29 10:10:14 -05:00
parent b77b59a4d3
commit 4443eb3bb8
No known key found for this signature in database
GPG key ID: DFB0E78F805F4567
5 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,23 @@
{{ define "main" }}
{{ partial "header.html" . }}
<main>
<article>
{{ .Content }}
{{ $items := getJSON "https://api.brandonrozek.com/postroll"}}
{{ if not $items }}
{{ warnf "Failed to fetch postroll items from API." }}
{{ $items = dict }}
{{ end }}
{{ with $items.Ok }}{{ range . }}
<div style="text-align: left;">
<p><a href="{{ .url }}"><strong style="font-size: 1.6rem;">{{ .title }}</strong></a> by {{ .author }}</p>
<p>{{ .comment }}</p>
</div>
{{ end }}{{ end }}
</article>
</main>
{{ end }}

View file

@ -21,7 +21,6 @@
{{ $postCount := len $posts }}
<p>
My most recent blog post was written on <strong>{{ $scratch.Get "latestDate" }}</strong>
with my first ever one written on <strong>{{ $scratch.Get "firstDate" }}</strong>.