From 8ddc2ec879b6ae2233c29561912bc300a78a17e2 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Fri, 22 Apr 2022 11:48:22 -0700 Subject: [PATCH] Make transcript the description of the image. --- content/posts/website-best-practices.md | 50 ++++++++++--------- layouts/shortcodes/picture.html | 5 ++ .../transcribed-image-figcaption.html | 3 -- .../shortcodes/transcribed-image-figure.html | 2 +- .../transcribed-image-transcript.html | 6 +-- 5 files changed, 36 insertions(+), 30 deletions(-) delete mode 100644 layouts/shortcodes/transcribed-image-figcaption.html diff --git a/content/posts/website-best-practices.md b/content/posts/website-best-practices.md index 2e86e8e..111d747 100644 --- a/content/posts/website-best-practices.md +++ b/content/posts/website-best-practices.md @@ -321,16 +321,16 @@ Another common offender is infinite-scrolling. In addition to requiring JavaScri #### Infinite scrolling {#infinite-scrolling} -{{< transcribed-image-figure id="xkcd-1309" >}} +{{< transcribed-image-figure id="xkcd-1309" has-transcript="true" >}} {{< picture name="infinite_scrolling" alt="Comic: if books had infinite-scroll, we'd have to turn pages carefully or risk losing the page." >}} -{{< transcribed-image-figcaption >}} +
-Infinite-scrolling means that accidentally navigating to a link will result in losing your place. Source: [xkcd](https://xkcd.com/1309/). - -{{< /transcribed-image-figcaption >}} {{< /transcribed-image-figure >}} +Infinite-scroll means that accidental navigation to a link results in losing your place. Source: [xkcd](https://xkcd.com/1309/). +
+{{< /transcribed-image-figure >}} {{< transcribed-image-transcript >}} Megan stands at a desk, reading a book, touching it very gingerly. Cueball is standing behind her. @@ -565,29 +565,33 @@ An image, alt-text, figure caption, and transcript combine to form a complex rel
Comic: if books had infinite-scroll, we'd have to
-           turn pages carefully or risk losing the page. + alt="Comic: if books had infinite-scroll, + we'd have to turn pages carefully or + risk losing the page.">
- Infinite-scrolling means that accidentally navigating - to a link will result in losing your place. + Infinite-scroll means that accidental navigation + to a link results in losing your place. See transcript.
-
+
Toggle transcript -

- Megan stands at a desk, reading a book, touching - it very gingerly. Cueball is standing behind her. -

-
-
Cueball
-
Why are you turning the pages like that?
-
Megan
-
If I touch the wrong thing, I’ll lose my place and - have to start over.
-
Caption below the panel
-
If books worked like infinite-scrolling webpages
-
+
+

+ Megan stands at a desk, reading a book, touching + it very gingerly. Cueball is standing behind her. +

+
+
Cueball
+
Why are you turning the pages like that?
+
Megan
+
If I touch the wrong thing, I’ll lose my + place and have to start over.
+
Caption below the panel
+
If books worked like infinite-scrolling + webpages
+
+
``` diff --git a/layouts/shortcodes/picture.html b/layouts/shortcodes/picture.html index 2ae7e66..5d36afe 100644 --- a/layouts/shortcodes/picture.html +++ b/layouts/shortcodes/picture.html @@ -82,5 +82,10 @@ {{ .Get "alt" }} {{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}} diff --git a/layouts/shortcodes/transcribed-image-figcaption.html b/layouts/shortcodes/transcribed-image-figcaption.html deleted file mode 100644 index e1767e4..0000000 --- a/layouts/shortcodes/transcribed-image-figcaption.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ .Inner | markdownify | safeHTML }} See transcript. -
diff --git a/layouts/shortcodes/transcribed-image-figure.html b/layouts/shortcodes/transcribed-image-figure.html index 053befb..ef0249e 100644 --- a/layouts/shortcodes/transcribed-image-figure.html +++ b/layouts/shortcodes/transcribed-image-figure.html @@ -1,5 +1,5 @@ {{ with .Parent -}} -
+
{{- end }} {{ .Inner | markdownify | safeHTML }}
diff --git a/layouts/shortcodes/transcribed-image-transcript.html b/layouts/shortcodes/transcribed-image-transcript.html index 75eab7d..c1e1e51 100644 --- a/layouts/shortcodes/transcribed-image-transcript.html +++ b/layouts/shortcodes/transcribed-image-transcript.html @@ -1,9 +1,9 @@ -
+Toggle transcript +
-Toggle transcript -
{{ .Inner | markdownify | safeHTML }}