Add partial for webmentions

Add partial for webmentions to
* home page
* single template
* list template

Partial template based on code from https://paul.kinlan.me/using-web-mentions-in-a-static-sitehugo-/
master
Kevin C. Coram 2019-12-23 17:55:57 -05:00
parent cd911f24b1
commit 32e496f364
Signed by: kevin
GPG Key ID: 0342351B3D61AD35
4 changed files with 29 additions and 0 deletions

View File

@ -21,5 +21,6 @@
{{ end }}
{{ end }}
{{ define "content-footer" }}
{{ partial "webmentions.html" . }}
{{ partial "paginator.html" .Paginator }}
{{ end }}

View File

@ -15,5 +15,6 @@
</article>
{{ end }}
{{ define "content-footer" }}
{{ partial "webmentions.html" . }}
{{ partial "prev-next-page.html" . }}
{{ end }}

View File

@ -19,5 +19,6 @@
</section>
{{ end }}
{{ define "content-footer" }}
{{ partial "webmentions.html" . }}
{{ partial "paginator.html" .Paginator }}
{{ end }}

View File

@ -0,0 +1,26 @@
{{ $urlized := .Page.Permalink | md5 }}
{{ if ne .Site.Data.webmentions nil }}
{{ if index .Site.Data.webmentions $urlized }}
<div class="webmentions">
{{ $likes := index (index .Site.Data.webmentions $urlized) "like-of" }}
{{ $replys := index (index .Site.Data.webmentions $urlized) "in-reply-to" }}
{{ $reposts := index (index .Site.Data.webmentions $urlized) "repost-of"}}
<h4>Likes</h4>
{{ range $i, $like := $likes }}
<a href="{{$like.url}}"><img src="{{ $like.author.photo}}" alt="{{ $like.author.name }}" class="profile photo"></a>
{{end}}
<h4>Reposts</h4>
{{ range $i, $repost := $reposts }}
<a href="{{$repost.url}}"><img src="{{ $repost.author.photo}}" alt="{{ $repost.author.name }}"
class="profile photo"></a>
{{end}}
<h4>Comments and Replies</h4>
{{ range $i, $reply := $replys }}
<a href="{{$reply.url}}"><img src="{{ $reply.author.photo}}" alt="{{ $reply.author.name }}"
class="profile photo"></a>
{{ end }}
</div>
{{ end }}
{{ end }}