From 42f4bc63adce93ab91350d5553c89090afbf0fb5 Mon Sep 17 00:00:00 2001 From: David Eisinger Date: Sun, 16 Feb 2025 02:26:24 -0500 Subject: [PATCH] Music listing page --- themes/v2/layouts/music/list.gmi | 8 ++++++++ themes/v2/layouts/partials/gemtext.gmi | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 themes/v2/layouts/music/list.gmi diff --git a/themes/v2/layouts/music/list.gmi b/themes/v2/layouts/music/list.gmi new file mode 100644 index 0000000..c303493 --- /dev/null +++ b/themes/v2/layouts/music/list.gmi @@ -0,0 +1,8 @@ +# {{ .Title }} + +{{ range where .Site.RegularPages "Params.exclude_music" "!=" true -}} +{{ range sort (.Resources.Match "*.mp3") "Title" "desc" -}} +=> {{ .RelPermalink }} {{ substr .Title 0 -4 }} +{{ end -}} +{{ end -}} + diff --git a/themes/v2/layouts/partials/gemtext.gmi b/themes/v2/layouts/partials/gemtext.gmi index a0273b1..5b871b3 100644 --- a/themes/v2/layouts/partials/gemtext.gmi +++ b/themes/v2/layouts/partials/gemtext.gmi @@ -11,7 +11,7 @@ {{ range findRE $audioRE $content -}} {{ $url := . | replaceRE $audioRE "$1" | replaceRE ` ` "%20" -}} {{ $title := . | replaceRE $audioRE "$2" -}} -{{ $content = replace $content . (printf "=> %s %s" $url $title) -}} +{{ $content = replace $content . (printf "=> %s %s" $url (substr $title 0 -4)) -}} {{ end -}} {{ range findRE `{{<(dither|thumbnail) [^/]+/>}}` $content -}} {{ $rendered := $page.RenderString . -}}