From 151b5149973594233512d27dba434184665e398827f7da361a644501a16b1e58 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson <> Date: Sun, 6 Sep 2026 00:00:00 +0000 Subject: Add audio support for entries on website --- assets/static/css/style.css | 2 +- i18n/en.toml | 9 +++++++++ i18n/es.toml | 9 +++++++++ layouts/_partials/pageinfo.html | 7 ++++++- layouts/single.html | 6 ++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/assets/static/css/style.css b/assets/static/css/style.css index 9c24bb0..f8a294a 100644 --- a/assets/static/css/style.css +++ b/assets/static/css/style.css @@ -136,7 +136,7 @@ article:last-child header p, margin-bottom: 1.0em; } -.entry__heading, .entry__pageinfo { +.entry__heading, .entry__pageinfo, .entry__audio { margin-bottom: 0.2em; margin-top: 0.2em; } diff --git a/i18n/en.toml b/i18n/en.toml index b82ce91..e885407 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -27,3 +27,12 @@ [pageNotFound] other = "Page Not Found" + +[audioAvailable] + other = "audio available" + +[audioVersion] + other = "Audio version of {{ . }}." + +[audioUnsupported] + other = "Your browser does not support audio playback." diff --git a/i18n/es.toml b/i18n/es.toml index 2a7ff92..7e98ed9 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -28,3 +28,12 @@ [pageNotFound] other = "Página no encontrada" + +[audioAvailable] + other = "audio disponible" + +[audioVersion] + other = "Versión en audio de {{ . }}." + +[audioUnsupported] + other = "Tu navegador no puede reproducir audio." diff --git a/layouts/_partials/pageinfo.html b/layouts/_partials/pageinfo.html index 9d60ea6..47f1194 100644 --- a/layouts/_partials/pageinfo.html +++ b/layouts/_partials/pageinfo.html @@ -20,4 +20,9 @@ {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} {{ end -}} -{{ if $nonBreakingTags }}{{ end }} +{{/* user-overridable parameter $audioAvailable is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingAudioAvailable := i18n "audioAvailable" .Title | htmlEscape -}} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable " " " " -}} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable "-" "‑" -}} + +{{ if where .Resources "MediaType.MainType" "audio" }}{{ end }}{{ if $nonBreakingTags }}{{ end }} diff --git a/layouts/single.html b/layouts/single.html index 9a8c8ae..e7522a0 100644 --- a/layouts/single.html +++ b/layouts/single.html @@ -7,6 +7,12 @@
{{ partial "pageinfo.html" . }}
+ {{- end -}} + {{ with index (where .Resources "MediaType.MainType" "audio") 0 }} + {{- end }} {{ chomp (.Content) }} -- cgit v1.2.3