From 5357bddd00f56e5413a8e3a819577da8787abed9 Mon Sep 17 00:00:00 2001 From: jk Date: Fri, 19 Jun 2020 23:56:39 +0100 Subject: [PATCH] maybe working with webmention hook now --- ...b0142775d59c592d2799c9d51f7a164146647.json | 2 +- ...65586591da8b22c634c619c7911614e5ab562.json | 2 +- ...5e033c6a06950ab2083f0fe11d5f76c1cadd3.json | 2 +- .../layouts/_default/backup_single.html | 102 ++++++++++++++++++ .../nipponalba/layouts/_default/single.html | 20 ++-- themes/nipponalba/layouts/partials/likes.html | 6 +- .../layouts/partials/webmention.html | 27 +++-- 7 files changed, 133 insertions(+), 28 deletions(-) create mode 100644 themes/nipponalba/layouts/_default/backup_single.html diff --git a/data/mentions/1b4283153d5dcc6d545ffcc63c1b0142775d59c592d2799c9d51f7a164146647.json b/data/mentions/1b4283153d5dcc6d545ffcc63c1b0142775d59c592d2799c9d51f7a164146647.json index c9ef9088..80d27683 100644 --- a/data/mentions/1b4283153d5dcc6d545ffcc63c1b0142775d59c592d2799c9d51f7a164146647.json +++ b/data/mentions/1b4283153d5dcc6d545ffcc63c1b0142775d59c592d2799c9d51f7a164146647.json @@ -1 +1 @@ -{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/social.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://social.nipponalba.scot/users/jk"},"url":"https://social.nipponalba.scot/notice/9wFJnxUQfLmV1EqEG8","published":"2020-06-19T16:16:57","wm-received":"2020-06-19T17:34:08Z","wm-id":812459,"wm-source":"https://brid-gy.appspot.com/comment/mastodon/@jk@social.nipponalba.scot/9wFHrwarjwcNUPcniq/9wFJnxUQfLmV1EqEG8","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","content":{"html":"Webhook reply test\n\n","text":"Webhook reply test"},"in-reply-to":"https://jk.nipponalba.scot/note/5eecdfdf/","wm-property":"in-reply-to","wm-private":false} \ No newline at end of file +{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/social.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://social.nipponalba.scot/users/jk"},"url":"https://social.nipponalba.scot/notice/9wFJnxUQfLmV1EqEG8","published":"2020-06-19T16:16:57","wm-received":"2020-06-19T17:34:08Z","wm-id":812459,"wm-source":"https://brid-gy.appspot.com/comment/mastodon/@jk@social.nipponalba.scot/9wFHrwarjwcNUPcniq/9wFJnxUQfLmV1EqEG8","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","content":{"html":"Webhook reply test\n\n","text":"Webhook reply test"},"inreplyto":"https://jk.nipponalba.scot/note/5eecdfdf/","wmproperty":"in-reply-to","wm-private":false} diff --git a/data/mentions/23840f8abecb05d77ffbe1b887b65586591da8b22c634c619c7911614e5ab562.json b/data/mentions/23840f8abecb05d77ffbe1b887b65586591da8b22c634c619c7911614e5ab562.json index a8bf2a8b..aed84675 100644 --- a/data/mentions/23840f8abecb05d77ffbe1b887b65586591da8b22c634c619c7911614e5ab562.json +++ b/data/mentions/23840f8abecb05d77ffbe1b887b65586591da8b22c634c619c7911614e5ab562.json @@ -1 +1 @@ -{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/social.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://social.nipponalba.scot/users/jk"},"url":"https://social.nipponalba.scot/notice/9wFHrwarjwcNUPcniq#favorited-by-1","published":null,"wm-received":"2020-06-19T17:34:09Z","wm-id":812460,"wm-source":"https://brid-gy.appspot.com/like/mastodon/@jk@social.nipponalba.scot/9wFHrwarjwcNUPcniq/1","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","like-of":"https://jk.nipponalba.scot/note/5eecdfdf/","wm-property":"like-of","wm-private":false} \ No newline at end of file +{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/social.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://social.nipponalba.scot/users/jk"},"url":"https://social.nipponalba.scot/notice/9wFHrwarjwcNUPcniq#favorited-by-1","published":null,"wm-received":"2020-06-19T17:34:09Z","wm-id":812460,"wm-source":"https://brid-gy.appspot.com/like/mastodon/@jk@social.nipponalba.scot/9wFHrwarjwcNUPcniq/1","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","likeof":"https://jk.nipponalba.scot/note/5eecdfdf/","wmproperty":"like-of","wm-private":false} diff --git a/data/mentions/91e2578f41914b11bbc3a99f01e5e033c6a06950ab2083f0fe11d5f76c1cadd3.json b/data/mentions/91e2578f41914b11bbc3a99f01e5e033c6a06950ab2083f0fe11d5f76c1cadd3.json index 118572d7..3639c20f 100644 --- a/data/mentions/91e2578f41914b11bbc3a99f01e5e033c6a06950ab2083f0fe11d5f76c1cadd3.json +++ b/data/mentions/91e2578f41914b11bbc3a99f01e5e033c6a06950ab2083f0fe11d5f76c1cadd3.json @@ -1 +1 @@ -{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/jk.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://jk.nipponalba.scot"},"url":"https://jk.nipponalba.scot/response/5eed09e4/","published":"2020-06-19T19:54:00","wm-received":"2020-06-19T18:59:57Z","wm-id":812483,"wm-source":"https://jk.nipponalba.scot/response/5eed09e4/","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","content":{"text":"Reply via indigenous"},"in-reply-to":"https://jk.nipponalba.scot/note/5eecdfdf/","wm-property":"in-reply-to","wm-private":false,"rels":{"canonical":"https://jk.nipponalba.scot/response/5eed09e4/"}} \ No newline at end of file +{"type":"entry","author":{"type":"card","name":"J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿","photo":"https://webmention.io/avatar/jk.nipponalba.scot/201caaea1889f39529535e829117ad39acdd7db241be2c888363e72bda171c67.jpg","url":"https://jk.nipponalba.scot"},"url":"https://jk.nipponalba.scot/response/5eed09e4/","published":"2020-06-19T19:54:00","wm-received":"2020-06-19T18:59:57Z","wm-id":812483,"wm-source":"https://jk.nipponalba.scot/response/5eed09e4/","wm-target":"https://jk.nipponalba.scot/note/5eecdfdf/","content":{"text":"Reply via indigenous"},"inreplyto":"https://jk.nipponalba.scot/note/5eecdfdf/","wmproperty":"in-reply-to","wm-private":false,"rels":{"canonical":"https://jk.nipponalba.scot/response/5eed09e4/"}} diff --git a/themes/nipponalba/layouts/_default/backup_single.html b/themes/nipponalba/layouts/_default/backup_single.html new file mode 100644 index 00000000..60c366aa --- /dev/null +++ b/themes/nipponalba/layouts/_default/backup_single.html @@ -0,0 +1,102 @@ + {{ define "main" }} +{{ if not (eq .Type "response" "bookmarkof")}} +
+ + {{ with .Page.Params.Image }}{{ partial "taxonomy/image.html" . }}{{ end }}

{{ .Title }}

{{ .Description }} + +
+{{ else if eq .Type "bookmarkof" }} +{{ $cats := slice }} +{{ range .Site.Data.bookmarks }} + {{ $cats = $cats | append .category }} +{{ end }} +{{ $cats = uniq $cats | sort }} +{{ range $cats }} + {{ $cat := . }} +

{{ $cat }}

+ {{ range $.Site.Data.bookmarks }} + {{ if eq .category $cat }} +
+ + +
+{{ end }} +{{ end }} +{{ end }} +{{ else }} +
+ +
+ {{ if .Params.likeof }}

Liked {{ .Params.likeof }}{{ end }} + {{ if .Params.inreplyto }}

Replied to {{ .Params.inreplyto }}{{ end }} + {{ if .Params.repostof }}

Shared {{ .Params.repostof }}{{ end }}

+ {{ if .Content }}

{{ .Content }}

{{end}} +
+ {{ if not (eq .Type "article") }}
+ {{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}
+
{{ end }} + {{end}} + +{{end}} diff --git a/themes/nipponalba/layouts/_default/single.html b/themes/nipponalba/layouts/_default/single.html index 60c366aa..77f7c058 100644 --- a/themes/nipponalba/layouts/_default/single.html +++ b/themes/nipponalba/layouts/_default/single.html @@ -47,15 +47,19 @@ -{{ $pathJSON := (print "data" (strings.TrimSuffix "/" .RelPermalink) ".json") }} -{{ if fileExists $pathJSON }} +{{ $mention_ids := index $.Site.Data.index .RelPermalink }} +{{ if isset $mention_ids 1}} +{{ $mentions := apply $mention_ids "index" $.Site.Data.mentions "." }} +{{ $mentions := sort $mentions "published" }}
-{{ $mJSON := getJSON $pathJSON }} - - -

Comments & Replies

{{ partial "webmention.html" $mJSON }} -
-{{ end }} + + +

Comments & Replies

{{ partial "webmention.html" $mentions }} +{{end}}
diff --git a/themes/nipponalba/layouts/partials/likes.html b/themes/nipponalba/layouts/partials/likes.html index f21a0b30..7220ac59 100644 --- a/themes/nipponalba/layouts/partials/likes.html +++ b/themes/nipponalba/layouts/partials/likes.html @@ -1,5 +1,7 @@ {{ range . }} -{{ if eq .mention_type "like" }} -{{ .author.name }} +{{ $_wm_property := "wm-property" }} +{{ .Params.wm_property }} +{{ if eq "wm-property" "life-of"}} +{{ .author.name }} {{ end }} {{ end }} diff --git a/themes/nipponalba/layouts/partials/webmention.html b/themes/nipponalba/layouts/partials/webmention.html index 0d7903ad..4370fa67 100644 --- a/themes/nipponalba/layouts/partials/webmention.html +++ b/themes/nipponalba/layouts/partials/webmention.html @@ -1,19 +1,16 @@ -{{ range sort . "date" "asc" }} +{{ range sort . "published" "asc" }}
-{{ if eq .mention_type "mention" }} -
-{{ .content | safeHTML }}
-
+{{if not (eq .wmproperty nil)}}{{ if eq .wmproperty "mention" }} +
+

{{ .content.text | safeHTML }}

+
{{ end }} -{{ if eq .mention_type "reply" }} -
{{ .author.name }} replied to this post here
-{{ .content | safeHTML }}
-
-{{ end }} -{{ if eq .mention_type "bookmark" }} -
{{ .author.name }} bookmarked this post
-{{ end }} -{{ if eq .mention_type "rsvp" }} -
{{ .author.name }} responded to the rsvp here
+{{ if eq .wmproperty "in-reply-to" }} +
{{ .author.name }} replied to this post here
+

{{ .content.text | safeHTML }}

+
{{ end }} +{{ if eq .wmproperty "bookmark" }} +
{{ .author.name }} bookmarked this post
+{{ end }}{{end}} {{ end }}