semantic-indieweb/layouts/partials/webmentions.html

51 lines
1.8 KiB
HTML
Raw Permalink Normal View History

{{ $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"}}
{{ $mentions := index (index .Site.Data.webmentions $urlized) "mention-of"}}
{{ if $likes }}
<h4>Likes</h4>
{{ range $i, $like := $likes }}
<a href="{{$like.url}}"><img src="{{ $like.author.photo}}" alt="{{ $like.author.name }}" class="profile photo like"></a>
{{ end }}
{{ end }}
{{ if $reposts }}
<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 }}
{{ end }}
{{ if $mentions }}
<h4>Mentions</h4>
<ul>
{{ range $i, $mention := $mentions }}
<li><a href="{{$mention.url}}">{{$mention.url}}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if $replys }}
<h4>Comments and Replies</h4>
{{ range $i, $reply := $replys }}
<div class="webmention reply">
<a href="{{$reply.url}}"><img src="{{ $reply.author.photo}}" alt="{{ $reply.author.name }}"
class="profile photo"></a>
<dl class="webmention reply">
<dt>Comment by {{ $reply.author.name }} on
{{ (time $reply.published).Local | dateFormat "Mon Jan 2, 2006" }}</dt>
<dd>
{{ $reply.content.text | replaceRE "\\n" "<br><br>" | safeHTML | truncate 512 }}
</dd>
</dl>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}