all repos — blog @ main

Code and content for 5ika.ch

layouts/shortcodes/books.html (view raw)

 1<div style="margin-top:2rem">
 2    {{ $outbox := dict }}
 3    {{ with resources.GetRemote "https://bookwyrm.social/user/5ika/outbox?page=1" }}
 4        {{ with .Err }}
 5            {{ errorf "%s" . }}
 6        {{ else }}
 7            {{ $outbox = . | transform.Unmarshal }}
 8            {{ range $outbox.orderedItems }}
 9                {{ if hasPrefix .content "<p>" }}
10                    <div>
11                        <a href='{{ .inReplyToBook }}' target="_blank">
12                            {{ with index .attachment 0 }}
13                                {{ (replaceRE ` \(.*?\)` "" (replaceRE `^(.*):` "<strong>$1</strong>" .name)) | safeHTML }}
14                            {{ end}}
15                        </a>
16                        <div style="margin-top:8px"><span class='date'>{{ dateFormat "2 Jan 2006"  .published }}</span></div>
17                        <blockquote>{{ (replaceRE `<p>\(comment on .*</p>` "" .content) | safeHTML}}</blockquote>
18                    </div>
19                {{ end }}
20            {{ end }}
21        {{ end }}
22    {{ end }}
23</div>