diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2024-05-17 23:37:43 +0200 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2024-05-18 14:47:09 +0200 |
commit | 8d7e708d98a3a46ba3ba08f9c8deeb4838bb8ca5 (patch) | |
tree | 6662c3e4c6c3baaea058a3deaba0d9cfc8e9cc40 /src/http/tpl | |
parent | fac06df97a47cda6e8989bfc5f40f2a627279b92 (diff) |
Render posts completely using common rendering methods
The aim is to reduce reliance on custom logic in the handlers for every
protocol, eventually outsourcing all of it into `render.Methods`,
leaving each protocol to simply direct calls to the correct template.
Diffstat (limited to 'src/http/tpl')
-rw-r--r-- | src/http/tpl/post.html | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/http/tpl/post.html b/src/http/tpl/post.html index db69302..0cf3622 100644 --- a/src/http/tpl/post.html +++ b/src/http/tpl/post.html @@ -1,45 +1,51 @@ {{ define "body" }} +{{ $post := .GetThisPost -}} <h1 id="post-headline"> - {{ .Payload.Title }} + {{ $post.Title }} </h1> -{{ if ne .Payload.Description "" }} +{{ if ne $post.Description "" }} <p> - <em>- {{ .Payload.Description }}</em> + <em>- {{ $post.Description }}</em> </p> {{ end }} <hr/> -{{ .Payload.Body }} +{{ .PostHTMLBody $post }} <p><em> - Published {{ DateTimeFormat .Payload.PublishedAt }} + Published {{ DateTimeFormat $post.PublishedAt }} </em></p> -{{ if (or .Payload.SeriesPrevious .Payload.SeriesNext) }} +{{- if $post.Series }} +{{ $seriesNextPrev := .GetPostSeriesNextPrevious $post -}} +{{ if or $seriesNextPrev.Next $seriesNextPrev.Previous }} <hr/> <p><em> This post is part of a series.<br/> - {{ if .Payload.SeriesPrevious }} - Previously: <a href="{{ PostURL .Payload.SeriesPrevious.ID }}">{{ .Payload.SeriesPrevious.Title }}</a> + {{ if $seriesNextPrev.Next }} + Next: <a href="{{ PostURL $seriesNextPrev.Next.ID }}">{{ $seriesNextPrev.Next.Title }}</a> {{ end }} - {{ if (and .Payload.SeriesNext .Payload.SeriesPrevious) }} + {{ if and $seriesNextPrev.Next $seriesNextPrev.Previous }} </br> {{ end }} - {{ if .Payload.SeriesNext }} - Next: <a href="{{ PostURL .Payload.SeriesNext.ID }}">{{ .Payload.SeriesNext.Title }}</a></br> + {{ if $seriesNextPrev.Previous }} + Previously: <a href="{{ PostURL $seriesNextPrev.Previous.ID }}">{{ $seriesNextPrev.Previous.Title }}</a> + <br/> {{ end }} </em></p> {{ end }} +{{ end }} {{ template "gemini-cta.html" . }} {{ end }} -{{ template "base.html" . }} +{{ $post := .GetThisPost -}} +{{ template "base.html" (.WithTitlePrefix $post.Title) }} |