Browse Source

maybe working with webmention hook now

master
jk 4 years ago
parent
commit
5357bddd00
  1. 2
      data/mentions/1b4283153d5dcc6d545ffcc63c1b0142775d59c592d2799c9d51f7a164146647.json
  2. 2
      data/mentions/23840f8abecb05d77ffbe1b887b65586591da8b22c634c619c7911614e5ab562.json
  3. 2
      data/mentions/91e2578f41914b11bbc3a99f01e5e033c6a06950ab2083f0fe11d5f76c1cadd3.json
  4. 102
      themes/nipponalba/layouts/_default/backup_single.html
  5. 20
      themes/nipponalba/layouts/_default/single.html
  6. 6
      themes/nipponalba/layouts/partials/likes.html
  7. 27
      themes/nipponalba/layouts/partials/webmention.html

2
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<a class=\"u-mention\" href=\"http://webmention.io/\"></a>\n<a class=\"u-mention\" href=\"https://webmention.io/\"></a>","text":"Webhook reply test"},"in-reply-to":"https://jk.nipponalba.scot/note/5eecdfdf/","wm-property":"in-reply-to","wm-private":false}
{"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<a class=\"u-mention\" href=\"http://webmention.io/\"></a>\n<a class=\"u-mention\" href=\"https://webmention.io/\"></a>","text":"Webhook reply test"},"inreplyto":"https://jk.nipponalba.scot/note/5eecdfdf/","wmproperty":"in-reply-to","wm-private":false}

2
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}
{"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}

2
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/"}}
{"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/"}}

102
themes/nipponalba/layouts/_default/backup_single.html

@ -0,0 +1,102 @@
{{ define "main" }}
{{ if not (eq .Type "response" "bookmarkof")}}
<article class="post h-entry entry contents">
<div class="author" style="display:none;">
<a rel="author" class="u-author h-card" rel="me" href="https://jk.nipponalba.scot">{{ .Site.Params.Title }}<img src="/images/profile.jpg"/></a>
</div>
{{ with .Page.Params.Image }}{{ partial "taxonomy/image.html" . }}{{ end }}<h3 class="p-name entry-title">{{ .Title }}</h3><b>{{ .Description }}</b>
<aside>
{{ if eq .Type "article" }}<div class="info">
{{ with .Page.Params.Blog }}Blog: {{ partial "taxonomy/blog.html" . }}{{ end }}<span id="info-date"><time class="dt-published" datetime="{{ .Date.Format "2 Jan 2006 15:04 GMT" }}">{{ .Date.Format "02/01/2006 15:04 GMT" }}</time></span><br/>
{{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}<span class="reading-time">{{ .ReadingTime }}-minute read</span><br/>
{{ with .Page.Params.tag }}Tags: {{ partial "taxonomy/tags.html" . }}{{ end }}
</div>{{ end }}
<div class="e-content">
{{ .Content }}
{{ if eq .Type "photo"}}
<div class="photogrid">
{{ range .Page.Params.Photo }}
<a href="{{ . }}"><img class="u-photo thumb" src="{{ replace . "800." "300."}}"/></a>
{{end}}
</div>
{{end}}
{{ if eq .Type "article" }}<div class="p-summary" style="display:none">
{{ .Page.Params.summary }}<br/>
</div>
{{ end }}<br/>
</div>
{{ if not (eq .Type "article") }}<div class="info">
{{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}
</div>{{ end }}
{{ $pathJSON := (print .Permalink "bridgy.json") }}
{{ $relpathJSON := (print .RelPermalink "bridgy.json") }}
{{ if fileExists $relpathJSON }}
<span class="syndication">
{{ $mJSON := getJSON $pathJSON }}
Syndicated to <a href="{{ printf $mJSON.url}}">Pleroma</a>
</span><span id="info-date"><a href="{{ .Permalink }}" class="u-url"><time class="dt-published" datetime="{{ .Date.Format "2 Jan 2006 15:04 GMT" }}">{{ .Date.Format "02/01/2006 15:04 GMT" }}</time></a></span>
{{ end }}
<a href="https://brid.gy/publish/mastodon"></a>
<div class="interactions"><h4>Interactions</h4></div>
<div class="webmention-form">
<form action="https://webmention.io/jk.nipponalba.scot/webmention" method="post">
<label>Did you mention this {{ .Type }} on your website? Put the URL of your post here:</label><br/>
<input name="source" type="url"/>
<input name="target" value="{{ .Permalink }}" type="hidden"/>
<input value="Send Webmention" type="submit"/>
</form>
</div>
{{ $pathJSON := (print "data" (strings.TrimSuffix "/" .RelPermalink) ".json") }}
{{ if fileExists $pathJSON }}
<div class="webmentions">
{{ $mJSON := getJSON $pathJSON }}
<div class="like interaction"><h4>Likes</h4>{{ partial "likes.html" $mJSON }}</div>
<div class="share interaction"><h4>Shares</h4>{{ partial "shares.html" $mJSON }}</div>
<h4>Comments & Replies</h4>{{ partial "webmention.html" $mJSON }}
</div>
{{ end }}
</aside>
</article>
{{ else if eq .Type "bookmarkof" }}
{{ $cats := slice }}
{{ range .Site.Data.bookmarks }}
{{ $cats = $cats | append .category }}
{{ end }}
{{ $cats = uniq $cats | sort }}
{{ range $cats }}
{{ $cat := . }}
<h4>{{ $cat }}</h4>
{{ range $.Site.Data.bookmarks }}
{{ if eq .category $cat }}
<section data-post-type="bookmark-of" data-post-id="{{ .Params.slug }}" class="bookmark h-entry">
<div class="author" style="display:none">
<a rel="author" class="p-author h-card" rel="me" href="https://jk.nipponalba.scot"><img src="/images/profile.jpg"/><div class="title">{{ .Site.Params.Title }}</div></a>
</div>
<aside>
<article class="h-cite">
<a href="{{ .bookmarkof | absURL }}" class="u-bookmark-of" target="_blank">{{ .name }}</a> - <div class="p-name p-content">{{ .content | markdownify }}</div>
</article>
</aside>
</section>
{{ end }}
{{ end }}
{{ end }}
{{ else }}
<article class="h-entry" id="response">
<div class="author">
<a rel="author" class="u-author h-card" rel="me" href="https://jk.nipponalba.scot"><img src="/images/profile.jpg"/><div class="title">{{ .Site.Params.Title }}</div></a>
</div>
<div>
{{ if .Params.likeof }}<p>Liked <a href="{{ .Params.likeof }}" class="u-url u-like-of"> {{ .Params.likeof }}</a>{{ end }}
{{ if .Params.inreplyto }}<p>Replied to <a href="{{ .Params.inreplyto }}" class="u-url u-in-reply-to"> {{ .Params.inreplyto }}</a>{{ end }}
{{ if .Params.repostof }}<p>Shared <a href="{{ .Params.repostof }}" class="u-url u-repost-of"> {{ .Params.repostof }}</a>{{ end }}</p>
{{ if .Content }}<div class="p-name p-content"><p>{{ .Content }}</p></div> {{end}}
</div>
{{ if not (eq .Type "article") }}<div class="info">
{{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}<span id="info-date"><a href="{{ .Permalink }}" class="u-url"><time class="dt-published" datetime="{{ .Date.Format "2 Jan 2006 15:04 GMT" }}">{{ .Date.Format "02/01/2006 15:04 GMT" }}</time></a></span><br/>
</div>{{ end }}
{{end}}
{{end}}

20
themes/nipponalba/layouts/_default/single.html

@ -47,15 +47,19 @@
<input value="Send Webmention" type="submit"/> <input value="Send Webmention" type="submit"/>
</form> </form>
</div> </div>
{{ $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" }}
<div class="webmentions"> <div class="webmentions">
{{ $mJSON := getJSON $pathJSON }}
<div class="like interaction"><h4>Likes</h4>{{ partial "likes.html" $mJSON }}</div>
<div class="share interaction"><h4>Shares</h4>{{ partial "shares.html" $mJSON }}</div>
<h4>Comments & Replies</h4>{{ partial "webmention.html" $mJSON }}
</div>
{{ end }}
<div class="like interaction"><h4>Likes</h4>{{ range $mentions }}{{ if eq .wmproperty "like-of" }}
<a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo }}" title="{{ .author.name }}" alt="{{ .author.name }}" /></a>{{ end}}
{{ end }}</div>
<div class="share interaction"><h4>Shares</h4>{{ range $mentions }}{{ if eq .wmproperty "repost-of" }}
<a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo }}" title="{{ .author.name }}" alt="{{ .author.name }}" /></a>{{ end}}
{{ end }}</div>
<h4>Comments & Replies</h4>{{ partial "webmention.html" $mentions }}
</div>{{end}}
</aside> </aside>
</article> </article>

6
themes/nipponalba/layouts/partials/likes.html

@ -1,5 +1,7 @@
{{ range . }} {{ range . }}
{{ if eq .mention_type "like" }}
<a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo_url }}" title="{{ .author.name }}" alt="{{ .author.name }}" /></a>
{{ $_wm_property := "wm-property" }}
{{ .Params.wm_property }}
{{ if eq "wm-property" "life-of"}}
<a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo }}" title="{{ .author.name }}" alt="{{ .author.name }}" /></a>
{{ end }} {{ end }}
{{ end }} {{ end }}

27
themes/nipponalba/layouts/partials/webmention.html

@ -1,19 +1,16 @@
{{ range sort . "date" "asc" }}
{{ range sort . "published" "asc" }}
<br/> <br/>
{{ if eq .mention_type "mention" }}
<div class="mention interaction"><div class="remote_profile"><a href="{{ .author.url }}"><img src="{{ .author.photo_url }}" /></a></div><div class="intcontent"><div class="intactivity"><a href="{{ .author.url }}">{{ .author.name }}</a> mentioned this post in <a href="{{ .url }}">the post {{ .title }}</a></div>
{{ .content | safeHTML }}<br/>
<time>{{ dateFormat "02/01/2006 15:04 GMT" ( time .date ) }}</time></div></div>
{{if not (eq .wmproperty nil)}}{{ if eq .wmproperty "mention" }}
<div class="mention interaction"><div class="remote_profile"><a href="{{ .author.url }}"><img src="{{ .author.photo }}" /></a></div><div class="intcontent"><div class="intactivity"><a href="{{ .author.url }}">{{ .author.name }}</a> mentioned this post in <a href="{{ .url }}">the post {{ .title }}</a></div>
<p>{{ .content.text | safeHTML }}</p>
<time>{{ dateFormat "02/01/2006 15:04 GMT" ( time .published ) }}</time></div></div>
{{ end }} {{ end }}
{{ if eq .mention_type "reply" }}
<div class="reply interaction"><div class="remote_profile"><a href="{{ .author.url }}"><img src="{{ .author.photo_url }}" /></a></div><div class="intcontent"><div class="intactivity"><a href="{{ .author.url }}">{{ .author.name }}</a> replied to this post <a href="{{ .url }}">here</a><br/></div>
{{ .content | safeHTML }}<br/>
<time>{{ dateFormat "02/01/2006 15:04 GMT" ( time .date ) }}</time></div></div>
{{ end }}
{{ if eq .mention_type "bookmark" }}
<div class="bookmark interaction"><a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo_url }}" /></a><a href="{{ .author.url }}">{{ .author.name }}</a> bookmarked this post</div>
{{ end }}
{{ if eq .mention_type "rsvp" }}
<div class="rsvp interaction"><a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo_url }}" /></a><a href="{{ .author.url }}">{{ .author.name }}</a> responded to the rsvp <a href="{{ .url }}">here</a></div>
{{ if eq .wmproperty "in-reply-to" }}
<div class="reply interaction"><div class="remote_profile"><a href="{{ .author.url }}"><img src="{{ .author.photo }}" /></a></div><div class="intcontent"><div class="intactivity"><a href="{{ .author.url }}">{{ .author.name }}</a> replied to this post <a href="{{ .url }}">here</a><br/></div>
<p>{{ .content.text | safeHTML }}</p>
<time>{{ dateFormat "02/01/2006 15:04 GMT" ( time .published ) }}</time></div></div>
{{ end }} {{ end }}
{{ if eq .wmproperty "bookmark" }}
<div class="bookmark interaction"><a href="{{ .author.url }}"><img class="remote_profile" src="{{ .author.photo }}" /></a><a href="{{ .author.url }}">{{ .author.name }}</a> bookmarked this post</div>
{{ end }}{{end}}
{{ end }} {{ end }}