mirror of
https://github.com/Brandon-Rozek/website.git
synced 2025-10-09 06:21:13 +00:00
Postroll feature
This commit is contained in:
parent
b77b59a4d3
commit
4443eb3bb8
5 changed files with 31 additions and 1 deletions
23
layouts/_default/postroll.html
Normal file
23
layouts/_default/postroll.html
Normal 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 }}
|
|
@ -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>.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue