From cd8d0e88ae24cf4a77931bd2b48579709ef7e5b5 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sun, 17 Jul 2022 19:25:38 -0700 Subject: [PATCH] Webmentions: don't use a
for no mentions When I have no webmentions, I shouldn't use a
to describe the menchie placeholder. --- layouts/partials/webmentions.html | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/layouts/partials/webmentions.html b/layouts/partials/webmentions.html index bd62424..b500140 100644 --- a/layouts/partials/webmentions.html +++ b/layouts/partials/webmentions.html @@ -4,15 +4,19 @@

Web­mentions

This site supports Webmentions, a backlink-based alternative to traditional comment forms.

{{ partial "webmention-form.html" . }} -

Webmentions received for this post will appear in the following list after I approve them. I sometimes send Webmentions to myself on behalf of linking sites that don't support them. Check the Wayback Machine if any links are broken.

+ {{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }} + {{ $url1 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}} + {{ $webmentions := (getJSON $url1) -}} + {{- if lt .Date.Unix 1653616670 -}}{{- /* commit c84c8d4 changed my URL schemes, so fetch menchies for the legacy scheme on old posts. */ -}} + {{- $oldTarget := $target | replaceRE "/posts" "" | replaceRE "/$" ".html" -}} + {{- $url2 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $oldTarget -}} + {{- $webmentions = $webmentions | append (getJSON $url2) -}} + {{- end -}} + {{- if gt (len $webmentions) 0 -}} +

Webmentions received for this post appear in the following list after I approve them. I sometimes send Webmentions to myself on behalf of linking sites that don't support them. I replace broken links with Wayback Machine snapshots, if they exist.

Toggle Webmentions
- {{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }} - {{- $oldTarget := $target | replaceRE "/posts" "" | replaceRE "/$" ".html" -}} - {{ $url1 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}} - {{ $url2 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $oldTarget -}} - {{ $webmentions := (getJSON $url1) | append (getJSON $url2) -}} {{ range sort $webmentions "created_at" -}} {{ $webmention := . -}} {{- /* Boolean: should we should handle this webmention like a comment or a linkback? */ -}} @@ -74,16 +78,16 @@ {{- if findRE `^https://brid.gy/[^/]*/mastodon` $webmention.source -}}

This comment may have major formatting errors that could impact screen reader comprehension.

{{- end -}} -

{{ $webmention.content | replaceRE `^@Seirdy(@pleroma.envs.net)? ?` ""}}

+

{{ $webmention.content | replaceRE `^@Seirdy(@pleroma.envs.net)? ?` ""}}

{{- end -}} {{- end }} - {{ else -}} -
Nothing here
-
This post does not have any approved Webmentions yet.
- {{- end }} + {{- end -}}
+ {{ else -}} +

This post does not have any approved Webmentions yet.

+ {{- end }}

Feel free to contact me directly with feedback; here’s my contact info