all repos — blog @ 04c9fd58850ccf705fcc60e76e0ec4788f5d2843

Code and content for 5ika.ch

layouts/shortcodes/books.html (view raw)

 1<div style="margin-top:2rem">
 2    {{ $pages := slice 1 2 3 4 }}
 3    {{ range $pages }}
 4        {{ $outbox := dict }}
 5        {{ $url := printf "https://bookwyrm.social/user/5ika/outbox?page=%d" . }}
 6        {{ with resources.GetRemote $url }}
 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>