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

Fix authorship metadata

This commit is contained in:
Rohan Kumar 2022-06-30 08:35:05 -07:00
parent cd82ce39ec
commit a4f5f797b6
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 12 additions and 3 deletions

View file

@ -2,12 +2,20 @@
{{- with .replyType -}} {{- with .replyType -}}
{{- $schemaType = . -}} {{- $schemaType = . -}}
{{- end -}} {{- end -}}
{{- $replyAuthorType := "Person" -}}
{{- with .replyAuthorType -}}
{{- $replyAuthorType = . -}}
{{- end -}}
{{- $replyAuthorRel := "author" -}}
{{- if eq $replyAuthorType "Organization" -}}
{{- $replyAuthorRel = "publisher" -}}
{{- end -}}
<aside role="note"> <aside role="note">
Reply to <span class="h-cite in-reply-to" itemprop="about" itemscope="" itemtype="https://schema.org/{{ $schemaType }}"> Reply to <span class="h-cite in-reply-to" itemprop="about" itemscope="" itemtype="https://schema.org/{{ $schemaType }}">
<cite itemprop="name" class="p-name"> <cite itemprop="name" class="p-name">
<a class="u-url" itemprop="url" href="{{ .replyURI }}">{{ .replyTitle | safeHTML}}</a> <a class="u-url" itemprop="url" href="{{ .replyURI }}">{{ .replyTitle | safeHTML}}</a>
</cite> by </cite> by
<span itemprop="author" itemscope="" itemtype="https://schema.org/Person" class="h-card vcard p-author"> <span itemprop="{{ $replyAuthorRel }}" itemscope="" itemtype="https://schema.org/{{ $replyAuthorType }}" class="h-card vcard p-author">
<a itemprop="url" href="{{ .replyAuthorURI }}" class="u-url url"> <a itemprop="url" href="{{ .replyAuthorURI }}" class="u-url url">
<span itemprop="name" class="p-name fn n">{{ .replyAuthor }}</span></a> <span itemprop="name" class="p-name fn n">{{ .replyAuthor }}</span></a>
</span> </span>

View file

@ -19,8 +19,9 @@
{{- $hasContent := and (isset $webmention "content") (gt (countrunes $webmention.content) 50) -}} {{- $hasContent := and (isset $webmention "content") (gt (countrunes $webmention.content) 50) -}}
{{- $title := $webmention.title -}} {{- $title := $webmention.title -}}
{{- /* Remove extraneous crap from Fediverse webmentions */ -}} {{- /* Remove extraneous crap from Fediverse webmentions */ -}}
{{- if findRE "@Seirdy@pleroma.envs.net" $webmention.title -}} {{- if findRE "@Seirdy" $webmention.title -}}
{{- $title = $title | replaceRE `@Seirdy@pleroma.envs.net(\n| )?` "" -}} {{- $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://bridg.gy" $webmention.source)) -}} {{- if and (isset $webmention "author_name") (findRE `@` $webmention.source) (not (findRE "^https://bridg.gy" $webmention.source)) -}}
{{ $title = $title | replaceRE `^[^:]{0,20}: ?` "" }} {{ $title = $title | replaceRE `^[^:]{0,20}: ?` "" }}
{{- end -}} {{- end -}}