From a9377c0817cadb7eff740863c49996274104172c Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 16 Nov 2025 17:38:05 -0700 Subject: [PATCH] Add shortcode for audio. --- layouts/shortcodes/audio.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 layouts/shortcodes/audio.html diff --git a/layouts/shortcodes/audio.html b/layouts/shortcodes/audio.html new file mode 100644 index 0000000..faa66f9 --- /dev/null +++ b/layouts/shortcodes/audio.html @@ -0,0 +1,24 @@ +{{ $src := .Get "src" | default (.Get 0) +}} {{ $type := .Get "type" +}} {{ if and (isset .Params "type") (not (eq $type "")) +}} {{ .Scratch.Set "type" $type +}} {{ else +}} {{ $type := strings.TrimSuffix $src (path.Ext $src) +}} {{ $type := strings.TrimPrefix "." $type +}} {{ .Scratch.Set "type" $type +}} {{ end +}} +{{ $text := .Get "text" +}} {{ if and (isset .Params "text") (not (eq $text "")) +}} {{ .Scratch.Set "text" $text +}} {{ else +}} {{ .Scratch.Set "text" "Audio playback is not available on your browser." +}} {{ end +}} + \ No newline at end of file