From 32e496f364cd6b8e232b98d41ba773cbd92dbaa4 Mon Sep 17 00:00:00 2001 From: "Kevin C. Coram" Date: Mon, 23 Dec 2019 17:55:57 -0500 Subject: [PATCH] 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-/ --- layouts/_default/list.html | 1 + layouts/_default/single.html | 1 + layouts/index.html | 1 + layouts/partials/webmentions.html | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 layouts/partials/webmentions.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 2ac074f..c0ec1d7 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -21,5 +21,6 @@ {{ end }} {{ end }} {{ define "content-footer" }} +{{ partial "webmentions.html" . }} {{ partial "paginator.html" .Paginator }} {{ end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1cee266..b873382 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -15,5 +15,6 @@ {{ end }} {{ define "content-footer" }} +{{ partial "webmentions.html" . }} {{ partial "prev-next-page.html" . }} {{ end }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 82905b8..ba0730c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -19,5 +19,6 @@ {{ end }} {{ define "content-footer" }} +{{ partial "webmentions.html" . }} {{ partial "paginator.html" .Paginator }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/webmentions.html b/layouts/partials/webmentions.html new file mode 100644 index 0000000..2085092 --- /dev/null +++ b/layouts/partials/webmentions.html @@ -0,0 +1,26 @@ +{{ $urlized := .Page.Permalink | md5 }} +{{ if ne .Site.Data.webmentions nil }} +{{ if index .Site.Data.webmentions $urlized }} +
+ {{ $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"}} +

Likes

+ {{ range $i, $like := $likes }} + {{ $like.author.name }} + {{end}} + +

Reposts

+ {{ range $i, $repost := $reposts }} + {{ $repost.author.name }} + {{end}} + +

Comments and Replies

+ {{ range $i, $reply := $replys }} + {{ $reply.author.name }} + {{ end }} +
+{{ end }} +{{ end }} \ No newline at end of file