From 7bd978465352a4a8a5d522fe9d6b9f3887edbbf4 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 29 Jun 2022 17:54:51 -0700 Subject: [PATCH] Microdata: fix relative urls, add a11y metadata - Add a11y metadata to transcribed images to communicate the presence of a transcript - Fix relative urls in navigation: make them absolute urls, so that the parsed navigation elements have the correct destinations. This also switches image transcripts from a section with a heading to a div with an ARIA label. That should reduce duplication between the content and the heading while still being semantically sound. --- content/posts/two-types-of-privacy.md | 2 +- content/posts/website-best-practices.md | 2 +- layouts/partials/header.html | 2 +- layouts/partials/post-meta.html | 2 +- layouts/posts/single.html | 2 +- layouts/shortcodes/indieweb-icon.html | 2 +- layouts/shortcodes/picture.html | 4 ++-- .../transcribed-image-transcript.html | 19 +++++++++++-------- layouts/shortcodes/transcribed-image.html | 9 ++++++++- 9 files changed, 27 insertions(+), 17 deletions(-) diff --git a/content/posts/two-types-of-privacy.md b/content/posts/two-types-of-privacy.md index 0c13b27..1077fe7 100644 --- a/content/posts/two-types-of-privacy.md +++ b/content/posts/two-types-of-privacy.md @@ -97,7 +97,7 @@ TE techniques typically revolve around minimizing the size of one's fingerprint, If an adversary employs multiple fingerprinting vectors, then normalizing or randomizing a small subset of those vectors might make a user stand out even more. -{{< transcribed-image type="comic" id="xkcd-1105" >}} +{{< transcribed-image type="comic" itemtype="VisualArtwork" id="xkcd-1105" >}} #### xkcd comic: license plate {#infinite-scrolling} diff --git a/content/posts/website-best-practices.md b/content/posts/website-best-practices.md index 5815868..047f4e9 100644 --- a/content/posts/website-best-practices.md +++ b/content/posts/website-best-practices.md @@ -363,7 +363,7 @@ A hybrid between the two is paginated content in which users click a "load next I've discussed loading pages in the background, but what about saving a page offline (e.g. with Ctrl + s)? While lazy-loading won't interfere with the ability to save a complete page offline, some of these related issues can. Excessive pagination and inline scrolling make it impossible to download a complete page without manually scrolling or following pagination links to the end. -{{< transcribed-image type="comic" id="xkcd-1309" >}} +{{< transcribed-image type="comic" itemtype="VisualArtwork" id="xkcd-1309" >}} #### xkcd comic: infinite scrolling {#infinite-scrolling} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 0682a1a..497706d 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -22,7 +22,7 @@ {{ range .Site.Menus.main -}} {{ $isCurrent := false }}
  • - Website{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and Gemini capsule{{- end -}}. +{{- $action }} {{ .Date.Format "2006-01-02" }} by {{ partial "indieweb-author.html" -}} on his {{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and Gemini capsule{{- end -}}. {{- if gt (sub .Lastmod.Unix .Date.Unix) 900 -}}
    Last updated . Changelog. diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 967eb83..2baa363 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,7 +1,7 @@ {{- define "main" -}} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- .Scratch.Set "codeIndex" 1 -}} -
    +
    {{ partial "full-article.html" . }} {{ partial "webmentions.html" . }} diff --git a/layouts/shortcodes/indieweb-icon.html b/layouts/shortcodes/indieweb-icon.html index 5e8e177..b33bcf5 100644 --- a/layouts/shortcodes/indieweb-icon.html +++ b/layouts/shortcodes/indieweb-icon.html @@ -6,5 +6,5 @@ src="data:image/png;base64,{{ $favicon_base64 }}" /> {{- else -}} + src="{{ $favicon_svg.Permalink }}" /> {{- end }} diff --git a/layouts/shortcodes/picture.html b/layouts/shortcodes/picture.html index c1a90d0..e0ea642 100644 --- a/layouts/shortcodes/picture.html +++ b/layouts/shortcodes/picture.html @@ -81,7 +81,7 @@ type="image/png" /> diff --git a/layouts/shortcodes/transcribed-image-transcript.html b/layouts/shortcodes/transcribed-image-transcript.html index 1c65398..9512ae2 100644 --- a/layouts/shortcodes/transcribed-image-transcript.html +++ b/layouts/shortcodes/transcribed-image-transcript.html @@ -1,11 +1,14 @@
    -Toggle transcript -{{ with .Parent -}} -
    -
    {{ .Get "type" | humanize}} transcript.
    -{{- end -}} -
    -{{ .Inner | markdownify | safeHTML }} + {{ with .Parent -}} + {{- $type := "image" -}} + {{- with .Get "type" -}} + {{- $type = . -}} + {{- end -}} + {{ $type | humanize }} transcript +
    + {{- end -}} +
    + {{ .Inner | markdownify | safeHTML }} +
    -
    diff --git a/layouts/shortcodes/transcribed-image.html b/layouts/shortcodes/transcribed-image.html index f017814..af7e339 100644 --- a/layouts/shortcodes/transcribed-image.html +++ b/layouts/shortcodes/transcribed-image.html @@ -1,7 +1,14 @@ {{- $type := "image" -}} +{{- $itemtype := "CreativeWork" -}} {{- with .Get "type" -}} {{- $type = . -}} {{- end -}} -
    +{{- with .Get "itemtype" -}} +{{- $itemtype = . -}} +{{- end -}} +
    {{ .Inner | markdownify | safeHTML }}