1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Fix: get webmentions from legacy URLs

This commit is contained in:
Rohan Kumar 2022-05-27 19:21:43 -07:00
parent 6c35495511
commit 3b8b35ce8c
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -3,8 +3,10 @@
<p>This site supports <a href="https://indieweb.org/webmention">Webmentions</a>. 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 <a href="https://web.archive.org/">Wayback Machine</a> if any links are broken.</p>
<dl>
{{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{ $url := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}}
{{ $webmentions := getJSON $url -}}
{{- $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 $webmentions -}}
{{ $webmention := . -}}
{{ if (eq $webmention.type "like") -}}