From 424afe0f8fed829758cc4d09722b4cfd98268734f82b799962369478389cf5dc Mon Sep 17 00:00:00 2001 From: Nicholas Johnson <> Date: Fri, 18 Sep 2026 00:00:00 +0000 Subject: Choose the best audio version of an entry Both templates took element 0 of the entry's audio resources, so an entry carrying more than one encoding used whichever filename sorted first, with no way to express a preference. An entry with a careful encoding and an mp3 beside it would commonly have offered the mp3. Order the resources by how they sound instead. Public listening tests put Opus ahead of the field at the bitrates spoken word uses, with Vorbis and AAC close behind it and MP3 last; the lossless formats come after the lossy ones rather than before, since a browser that can play FLAC would otherwise fetch several times the bytes for no audible gain. Formats the theme does not rank keep Hugo's own order at the end. The capsule links the first of them, since a Gemini client cannot choose between sources and a reader wants one file to fetch. The website offers them all as the alternative sources that the audio element exists to choose between, best first, so a browser plays the best encoding it understands. Hugo reports .opus, .oga and .ogg alike as audio/ogg, so the ordering keys off the file extension rather than the media type. Co-Authored-By: Claude Opus 5 --- layouts/single.gmi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'layouts/single.gmi') diff --git a/layouts/single.gmi b/layouts/single.gmi index 29df881..2cee33d 100644 --- a/layouts/single.gmi +++ b/layouts/single.gmi @@ -8,9 +8,9 @@ {{ partial "pageinfo.gmi" . }} {{- end -}} -{{ with index (where .Resources "MediaType.MainType" "audio") 0 }} +{{ with partial "audio.html" . }}{{ with index . 0 }} => {{ .RelPermalink }} {{ emojify ":link:" }} {{ i18n "downloadAudio" $.Title }} -{{- end }} +{{- end }}{{ end }} {{ $content := chomp (.RawContent) -}} {{ $scratch := newScratch -}} -- cgit v1.2.3