Web­mentions

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

Send a Webmention{{ partial "webmentions/webmention-form.html" . }}
{{- /* Filter webmentions to just the ones for the current targets */ -}} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" -}} {{- $target := printf "%s%s" .Site.Params.CanonicalBaseURL $canonicalRelPermalink -}} {{- $targets := (slice $target) -}} {{- /* commit c84c8d4 changed my URL schemes, so fetch menchies for the legacy scheme on old posts. */ -}} {{- if lt .Date.Unix 1653616670 -}} {{- $oldTarget := $target | replaceRE "/posts" "" | replaceRE "/$" ".html" -}} {{ $targets = (slice $target $oldTarget) }} {{- end -}} {{- /* We can't just use a simple "where" function because we need to ignore URL anchors/query-params when making a comparison: https://discourse.gohugo.io/t/add-like-comparison-operator-to-the-where-function/42013/4 */ -}} {{- $webmentions := slice -}} {{- range partialCached "webmentions/all-webmentions.html" . -}} {{- $u := urls.Parse .target -}} {{- $trimmedTarget := printf `https://%s%s` $u.Hostname $u.Path -}} {{- if in $targets $trimmedTarget -}} {{ $webmentions = $webmentions | append . }} {{- end -}} {{- end -}} {{- /* Render webmentions if they exist */ -}} {{- $count := (len $webmentions) -}} {{- .Page.Scratch.Set "webmentionCount" $count -}} {{- if gt $count 0 -}}
Toggle {{ $count }} Webmentions

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 auto-replace broken links with Wayback Machine snapshots, if they exist.

{{ range sort $webmentions "created_at" -}} {{ $webmention := . -}} {{- /* Boolean: should we should handle this webmention like a comment or a linkback? */ -}} {{- $hasContent := and (isset $webmention "content") (gt (countrunes $webmention.content) 50) -}} {{- $title := $webmention.title -}} {{- /* Remove extraneous crap from Fediverse webmentions */ -}} {{- if findRE "@Seirdy" $webmention.title -}} {{- $title = $title | replaceRE `^@Seirdy@pleroma.envs.net(\n| )?` "" -}} {{- /* Mastodon webmentions may include the author in the title followed by a colon; this is redundant. */ -}} {{- if and (isset $webmention "author_name") (findRE `@` $webmention.source) (not (findRE "^https://brid.gy" $webmention.source)) -}} {{ $title = $title | replaceRE `^[^:]{0,20}: ?` "" | replaceRE `^"@Seirdy@pleroma.envs.net ?` `"` }} {{- end -}} {{- end -}} {{- if and ($hasContent) (gt (countrunes $webmention.title) 128) -}} {{- $title = $webmention.title | strings.TrimSuffix "…" | truncate 128 -}} {{- end -}} {{- $src := $webmention.source -}} {{- with index (partialCached "webmentions/rewrites.html" .) $src -}} {{- $src = . -}} {{- end -}} {{- if in (partialCached "webmentions/wbm-links.html" .) $src -}} {{- $src = printf "https://web.archive.org/web/0/%s" $src -}} {{- end -}} {{ if (eq $webmention.type "like") -}}
{{- else -}}
{{- end -}}
{{ if (eq $webmention.type "like") -}} {{ if $webmention.author_name -}} {{ $webmention.author_name }} {{ else if $webmention.title -}} {{ $webmention.title | replaceRE ` \n` ` ` -}} {{ else -}} {{ $webmention.source | strings.TrimPrefix "https://" | strings.TrimPrefix "www." | strings.TrimRight "/" | truncate 35 -}} {{ end -}} this {{- else -}} {{- if findRE `^https://brid.gy/[^/]*/mastodon` $webmention.source -}} {{- $canonicalSrc := replaceRE "https://brid.gy/.*mastodon/@Seirdy@pleroma.envs.net/([^/]*)(.*)?" `https://pleroma.envs.net/notice/$1` $src -}} {{- if $webmention.author_name }} by {{- end -}} {{- if $hasContent -}} {{- 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)? ?` "" | chomp}}

{{- end -}} {{- 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