1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-27 14:12:09 +00:00

Handle "like" webmentions properly

Display a "like" webmention in the format "<Name> liked this" instead of
using the standard pingback format.
This commit is contained in:
Rohan Kumar 2021-01-19 13:16:42 -08:00
parent 8a527895a3
commit 552b8c9417
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -14,34 +14,38 @@
<section class="e-content" itemprop="articlebody"> <section class="e-content" itemprop="articlebody">
{{ partial "processed-content" . -}} {{ partial "processed-content" . -}}
</section> </section>
</article> </article>
<hr> <hr>
<footer class="comment"> <footer class="comment">
{{ with .OutputFormats.Get "gemtext" -}} {{ with .OutputFormats.Get "gemtext" -}}
<p> <p>
View this article on <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">my Gemini capsule</a> View this article on <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">my Gemini capsule</a>
</p> </p>
{{ end -}} {{ end -}}
<p><a href="mailto:~seirdy/seirdy.one-comments@lists.sr.ht">Send an email</a> to leave a comment in the <a href="https://lists.sr.ht/~seirdy/seirdy.one-comments">mailing list</a> for seirdy.one. You'll have to send in plain text; please <a href="https://useplaintext.email/">learn how</a>. Alternatively, send your email <a href="mailto:seirdy@seirdy.one">directly to me</a>; it wont show up on the mailing list, but Ill see it.</p> <p><a href="mailto:~seirdy/seirdy.one-comments@lists.sr.ht">Send an email</a> to leave a comment in the <a href="https://lists.sr.ht/~seirdy/seirdy.one-comments">mailing list</a> for seirdy.one. You'll have to send in plain text; please <a href="https://useplaintext.email/">learn how</a>. Alternatively, send your email <a href="mailto:seirdy@seirdy.one">directly to me</a>; it wont show up on the mailing list, but Ill see it.</p>
<p>This site also supports <a href="https://indieweb.org/webmention">Webmentions</a>. Webmentions received for this post will appear below after I approve them.</p> <p>This site also supports <a href="https://indieweb.org/webmention">Webmentions</a>. Webmentions received for this post will appear below after I approve them.</p>
<section class="webmentions"> <section class="webmentions">
<h2>Webmentions</h2> <h2>Webmentions</h2>
<ul class="unstyled-list"> <ul class="unstyled-list">
{{ $target := .RelPermalink -}} {{ $target := .RelPermalink -}}
{{ $url := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}} {{ $url := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}}
{{ $webmentions := getJSON $url -}} {{ $webmentions := getJSON $url -}}
{{ range $webmentions -}} {{ range $webmentions -}}
{{ $webmention := . -}} {{ $webmention := . -}}
<li> <li>
<time datetime="{{ dateFormat "2006-01-02 15:04:05Z07:00" $webmention.created_at }}">{{ dateFormat "2006-01-02" $webmention.created_at }}</time> <time datetime="{{ dateFormat "2006-01-02 15:04:05Z07:00" $webmention.created_at }}">{{ dateFormat "2006-01-02" $webmention.created_at }}</time>
<br> <br>
<a href="{{ $webmention.source }}" rel="nofollow">{{ $webmention.title }}</a> {{ if (eq $webmention.type "like") -}}
</li> <a href="{{ $webmention.source }}" rel="nofollow">{{ $webmention.author_name }}</a> liked this
{{ else -}} {{else -}}
<li><p>This post doesn't have any approved Webmentions yet.</p></li> <a href="{{ $webmention.source }}" rel="nofollow">{{ $webmention.title }}</a>
{{ end -}} {{- end }}
</ul> </li>
</section> {{ else -}}
</footer> <li><p>This post doesn't have any approved Webmentions yet.</p></li>
{{- end }}
</ul>
</section>
</footer>
</div> </div>
{{ end }} {{ end }}