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

Use WAI-ARIA 1.3's "comment" role on webmentions

This commit is contained in:
Rohan Kumar 2022-05-12 18:39:34 -07:00
parent a9039e1bde
commit 7b236f003c
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 9 additions and 3 deletions

View file

@ -1,4 +1,4 @@
<article class="h-entry hentry">
<article aria-details="webmentions" class="h-entry hentry">
<header>
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
{{- if not .Params.disableMeta }}

View file

@ -2,7 +2,7 @@
<h2 id="webmentions">Webmen&shy;tions</h2>
<p>This site supports <a href="https://indieweb.org/webmention">Webmentions</a>. Webmentions received for this post will appear below 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>
<ul>
{{ $target := .RelPermalink -}}
{{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{ $url := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}}
{{ $webmentions := getJSON $url -}}
{{ range $webmentions -}}
@ -10,7 +10,7 @@
{{ if (eq $webmention.type "like") -}}
<li itemprop="potentialAction" itemscope itemtype="https://schema.org/LikeAction" class="u-like h-cite">
{{- else -}}
<li itemprop="comment" itemscope itemtype="https://schema.org/Comment" class="u-comment h-cite">
<li itemprop="comment" role="comment" itemscope itemtype="https://schema.org/Comment" class="u-comment h-cite">
{{- end }}
<p>
<time class="dt-published" itemprop="{{ if (eq $webmention.type "like") -}}startTime{{ else }}datePublished{{ end }}" datetime="{{ dateFormat "2006-01-02 15:04:05Z07:00" $webmention.created_at }}" title="{{ dateFormat "2006-01-02 15:04:05Z07:00" $webmention.created_at }}">{{ dateFormat "2006-01-02" $webmention.created_at }}</time>

View file

@ -14,6 +14,12 @@
and .firstColumn == 1
and (.extract | test(" name=\"theme-color\""))
)
or
( # See https://w3c.github.io/aria/#comment
.message == "Bad value “comment” for attribute “role” on element “li”."
and (.extract | test("u-comment"))
and (.extract | test("itemprop=\"comment\""))
)
) | not
)
)