diff --git a/config.toml b/config.toml index f854dd69..96bf4d60 100644 --- a/config.toml +++ b/config.toml @@ -6,10 +6,11 @@ theme = "minimage" disqusShortname = "" # Enable Google Analytics by entering your tracking code googleAnalytics = "" -paginate = 5 Copyright = "All rights reserved - 2006-" preserveTaxonomyNames = true #canonifyurls = true +[paginationp] + pagerSize = 5 [taxonomies] category = "categories" diff --git a/content/post/2022/12/check-in-2022-q4.md b/content/post/2022/12/check-in-2022-q4.md index ed80c299..dfd23338 100644 --- a/content/post/2022/12/check-in-2022-q4.md +++ b/content/post/2022/12/check-in-2022-q4.md @@ -16,7 +16,7 @@ Focus_Keyword: "close" # Technology Since all the changes on [Twitter](https://twitter.com/duckunix), I am now active on [Fosstodon](https://fosstodom/@duckunix), which is a [Mastodon](https://joinmastodon.org/). I joined back in 2018, but I just started using it more. My #introduction toot: -{{}} +{{}} On the home network front, I finally retired the big server as the drivers were failing. I decided to move the containers running there to my old desktop which was not doing anything. Some new disks, and life is better there. diff --git a/themes/minimage/layouts/shortcodes/smoot.html b/themes/minimage/layouts/shortcodes/smoot.html index 803df3d0..1ac7b2e7 100644 --- a/themes/minimage/layouts/shortcodes/smoot.html +++ b/themes/minimage/layouts/shortcodes/smoot.html @@ -1,157 +1,167 @@ -{{ $masIns := .Get 0 }} +{{ $masIns := .Get "instance" }} +{{ $id := .Get "id" }} {{ $tootLink := "" }} {{ $card := "" }} {{ $handleInst := "" }} {{ $mediaMD5 := "" }} {{ $imageCount := 0 }} {{ $votesCount := 0 }} -{{ $id := .Get 1 }} {{ $urlToGet := print "https://" $masIns "/api/v1/statuses/" $id }} -{{ $json := getJSON $urlToGet }} -{{ $jsonHolder := $json }}{{/* Being safe */}} -{{ if isset $json "account" }} - {{ $tootLink = print "https://" $masIns "@" $json.account.acct "/status/" $id }} - {{ $handleInst = print "@" $json.account.acct "@" $masIns }} -{{ end }} +{{- with resources.GetRemote $urlToGet -}} + {{ if (resources.GetRemote $urlToGet).Err }} +
+ +
+ {{ else }} + {{ $json := unmarshal .Content }} + {{ $jsonHolder := $json }}{{/* Being safe */}} -{{ if isset $json "content" }} -
- -

- {{ $json.content | safeHTML }} -

- {{ with $json.media_attachments }} - {{ range $media_attachments := . }} - {{ if eq $media_attachments.type "image" }} - {{ $imageCount = (add ($imageCount) 1) }} - {{ end }} - {{ end }} -
- {{ range $media_attachments := . }} - {{ if eq $media_attachments.type "image" }} - {{ $mediaMD5 = md5 $media_attachments.url }} - - Image {{ $media_attachments.id }} from toot {{ $id }} on {{ $masIns }} - {{- if $json.sensitive -}} -
- Sensitive content
- (flagged at origin) -
- {{- end -}} - {{ end }} - {{ end }} -
- {{/* - N.B.: - The above results in an empty, no-height div - when there's no image but there **is** - at least one item in `$media_attachments`. - Unfortunately, it seems to be the only way - to accomplish this. Not a good HTML practice, - but gets the job done. - */}} - {{ range $media_attachments := . }} - {{ if eq $media_attachments.type "video" }} - {{ $mediaMD5 = md5 $media_attachments.url }} - -
- - {{- if $json.sensitive -}} -
- Sensitive content
- (flagged at origin) -
- {{- end -}} -
- {{ end }} - {{ if eq $media_attachments.type "gifv" }} - {{ $mediaMD5 = md5 $media_attachments.url }} - -
- - {{- if $json.sensitive -}} -
- Sensitive content
- (flagged at origin) -
- {{- end -}} -
- {{ end }} - {{ end }} - {{ end }} - {{ with $json.card }} - {{- $cardData := . -}} - {{- with $cardData.image -}} - -
- Card image from {{ $masIns }} toot {{ $id }} -

- {{ $cardData.title }}
- {{ $cardData.description }} -

-
-
- {{- end -}} - {{ end }} - {{ with $json.poll }} - {{ $poll := . }} - {{ with $poll.options }} - {{ range $pollOptions := . }} - {{ $votesCount = add $votesCount $pollOptions.votes_count }} - {{ end }} -
- {{ range $pollOptions := . }} -
- {{ (mul 100 (div $pollOptions.votes_count $votesCount)) | lang.FormatPercent 1 }} -
-
- -
-
{{ $pollOptions.title }}
- {{ end }} -
- - {{ end }} - {{ end }} - -
-{{ end }} + {{ if isset $json "account" }} + {{ $tootLink = print "https://" $masIns "@" $json.account.acct "/status/" $id }} + {{ $handleInst = print "@" $json.account.acct "@" $masIns }} + {{ end }} + + {{ if isset $json "content" }} +
+ + {{ $json.content | safeHTML }} + {{ with $json.media_attachments }} + {{ range $media_attachments := . }} + {{ if eq $media_attachments.type "image" }} + {{ $imageCount = (add ($imageCount) 1) }} + {{ end }} + {{ end }} +
+ {{ range $media_attachments := . }} + {{ if eq $media_attachments.type "image" }} + {{ $mediaMD5 = md5 $media_attachments.url }} + + Image {{ $media_attachments.id }} from toot {{ $id }} on {{ $masIns }} + {{- if $json.sensitive -}} +
+ Sensitive content
+ (flagged at origin) +
+ {{- end -}} + {{ end }} + {{ end }} +
+ {{/* + N.B.: + The above results in an empty, no-height div + when there's no image but there **is** + at least one item in `$media_attachments`. + Unfortunately, it seems to be the only way + to accomplish this. Not a good HTML practice, + but gets the job done. + */}} + {{ range $media_attachments := . }} + {{ if eq $media_attachments.type "video" }} + {{ $mediaMD5 = md5 $media_attachments.url }} + +
+ + {{- if $json.sensitive -}} +
+ Sensitive content
+ (flagged at origin) +
+ {{- end -}} +
+ {{ end }} + {{ if eq $media_attachments.type "gifv" }} + {{ $mediaMD5 = md5 $media_attachments.url }} + +
+ + {{- if $json.sensitive -}} +
+ Sensitive content
+ (flagged at origin) +
+ {{- end -}} +
+ {{ end }} + {{ end }} + {{ end }} + {{ with $json.card }} + {{- $cardData := . -}} + {{- with $cardData.image -}} + +
+
+ Card image from {{ $masIns }} toot {{ $id }} +
+
+

{{ $cardData.title }}

+

{{ $cardData.description }}

+
+
+
+ {{- end -}} + {{ end }} + {{ with $json.poll }} + {{ $poll := . }} + {{ with $poll.options }} + {{ range $pollOptions := . }} + {{ $votesCount = add $votesCount $pollOptions.votes_count }} + {{ end }} +
+ {{ range $pollOptions := . }} +
+ {{ (mul 100 (div $pollOptions.votes_count $votesCount)) | lang.FormatPercent 1 }} +
+
+ +
+
{{ $pollOptions.title }}
+ {{ end }} +
+ + {{ end }} + {{ end }} + +
+ {{ end }} + {{ end }} +{{- end -}}