aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--layouts/shortcodes/audio.html16
2 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index 01956a5..21c36ae 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,11 @@ simplesource
A Hugo theme that is minimalistic and 'simple'. Inspired and partially based on
the CSS used for [sourcehut](https://sourcehut.org/).
+### Features
+
+#### Shortcodes:
+* audio Allows for embedding of audio files. Params: src="" type=""
+
Copyright and Licenses
======================
diff --git a/layouts/shortcodes/audio.html b/layouts/shortcodes/audio.html
new file mode 100644
index 0000000..d64d850
--- /dev/null
+++ b/layouts/shortcodes/audio.html
@@ -0,0 +1,16 @@
+<audio controls>
+ {{ if .IsNamedParams }}
+ {{ if isset .Params "src" }}
+ {{ if isset .Params "type" }}
+ <source src="{{ .Get "src" }}" type="audio/{{ .Get "type" }}">
+ {{ else }}
+ {{ errorf "Missing type parameter: %s" .Position }}
+ {{ end }}
+ {{ else }}
+ {{ errorf "Missing src parameter: %s" .Position }}
+ {{ end }}
+ {{ else }}
+ {{ errorf "Missing parameter names: %s" .Position }}
+ {{ end }}
+Browser does not support embedded audio.
+</audio>