{{ $currentPagePath := .RelPermalink }} {{ $webmentions := slice }} {{ range .Site.Data.webmentions }} {{ $urlObj := urls.Parse .webmention.target }} {{ $targetPath := $urlObj.Path }} {{ if or (strings.Contains $targetPath $currentPagePath) (strings.Contains $targetPath ($currentPagePath | urlquery)) }} {{ $webmentions = $webmentions | append . }} {{ end }} {{ end }} {{ $other_webmentions := where .Site.Data.webmentions "webmention.target" (printf "/posts%s" .RelPermalink ) }} {{ if $other_webmentions }} {{ $webmentions = $webmentions | union $other_webmentions }} {{ end }} {{ $likes := slice }} {{ $replies := slice }} {{ $reposts := slice }} {{ $mentions := slice }} {{ range $webmentions }} {{ $props := index . "microformats" "properties" }} {{ $type := index . "microformats" "type" 0 }} {{ if eq $type "h-entry" }} {{ if index $props "like-of" }} {{ $likes = $likes | append . }} {{ else if index $props "repost-of" }} {{ $reposts = $mentions | append . }} {{ else }} {{ $replies = $replies | append . }} {{ end }} {{ else }} {{ $mentions = $mentions | append . }} {{ end }} {{ end }} {{ partial "posts/action-area" . }}
{{ partial "posts/webmention-summary" (dict "likes" $likes "page" . "othercount" (add (len $replies) (len $mentions)) ) }}
{{ partial "posts/webmention-replies" $replies }} {{ partial "posts/webmention-mentions" $mentions }}
{{ partial "posts/comment" . }}