mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 15:56:29 -05:00
Added shortcode to display local toot
This commit is contained in:
parent
2c1cefd461
commit
69eb301405
1 changed files with 30 additions and 0 deletions
30
layouts/shortcodes/displayToot.html
Normal file
30
layouts/shortcodes/displayToot.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{{ $toot_reference := .Get 0 }}
|
||||||
|
{{ $url := printf "static/data/toots/%s.json" $toot_reference }}
|
||||||
|
{{ $dataJ := getJSON $url }}
|
||||||
|
|
||||||
|
{{ with $dataJ }}
|
||||||
|
{{ if ne .content "" }}
|
||||||
|
<article class="toot h-entry">
|
||||||
|
<div class="e-content">
|
||||||
|
<img class="toot-avatar" width=50 src="{{ .account.avatar }}"/>
|
||||||
|
<p class="date">Tooted on <time class="dt-published" datetime='{{ .created_at }}'>{{ dateFormat "January 2, 2006 15:04" (time .created_at) }}</time></p>
|
||||||
|
{{ .content | safeHTML }}
|
||||||
|
{{ if gt (len .media_attachments) 0 }}
|
||||||
|
<div class="toot-photos">
|
||||||
|
{{ range .media_attachments}}
|
||||||
|
{{ if eq .type "image" }}
|
||||||
|
<img src="{{ .preview_url }}" alt="{{ .description }}"/>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
<div class="toot-social">
|
||||||
|
<span><i class='fas fa-share'></i> {{ .replies_count }} </span>
|
||||||
|
<span><i class='fas fa-retweet'></i> {{ .reblogs_count }} </span>
|
||||||
|
<span><i class='fas fa-star'></i> {{ .favourites_count }} </span>
|
||||||
|
<span>| Source: <a href="{{ .url }}">{{ .url }}</a></span>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
Loading…
Reference in a new issue