From 3630afdfdf5f69343d1d4a85e4888b904c9d682984ee9fd9eaefa6b822661572 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 capsule --- i18n/en.toml | 3 +++ i18n/es.toml | 3 +++ layouts/_partials/pageinfo.gmi | 6 +++++- layouts/single.gmi | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/i18n/en.toml b/i18n/en.toml index e885407..307a669 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -36,3 +36,6 @@ [audioUnsupported] other = "Your browser does not support audio playback." + +[downloadAudio] + other = "Download audio version of {{ . }}" diff --git a/i18n/es.toml b/i18n/es.toml index 7e98ed9..58dfdb9 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -37,3 +37,6 @@ [audioUnsupported] other = "Tu navegador no puede reproducir audio." + +[downloadAudio] + other = "Descargar la versión en audio de {{ . }}" diff --git a/layouts/_partials/pageinfo.gmi b/layouts/_partials/pageinfo.gmi index 7c822f3..f68fa2f 100644 --- a/layouts/_partials/pageinfo.gmi +++ b/layouts/_partials/pageinfo.gmi @@ -15,4 +15,8 @@ {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} {{ end -}} -{{ emojify ":calendar:" }} {{ $nonBreakingPublishDate }} {{ emojify ":stopwatch:" }} {{ $nonBreakingReadingTime }}{{ if $nonBreakingTags }} {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file +{{ $nonBreakingAudioAvailable := i18n "audioAvailable" -}} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable " " " " -}} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable "-" "‑" -}} + +{{ emojify ":calendar:" }} {{ $nonBreakingPublishDate }} {{ emojify ":stopwatch:" }} {{ $nonBreakingReadingTime }}{{ if where .Resources "MediaType.MainType" "audio" }} {{ emojify ":headphones:" }} {{ $nonBreakingAudioAvailable }}{{ end }}{{ if $nonBreakingTags }} {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file diff --git a/layouts/single.gmi b/layouts/single.gmi index 26c8cee..2cf53a4 100644 --- a/layouts/single.gmi +++ b/layouts/single.gmi @@ -6,6 +6,10 @@ # {{ .Title }} {{- if (.Page.Params.pageinfo | default true) }} {{ partial "pageinfo.gmi" . }} +{{- end -}} + +{{ with index (where .Resources "MediaType.MainType" "audio") 0 }} +=> {{ .RelPermalink }} {{ emojify ":link:" }} {{ i18n "downloadAudio" $.Title }} {{- end }} {{ $content := chomp (.RawContent) -}} -- cgit v1.2.3