diff --git a/exampleSite/content/en/shortcodes/audio/_index.md b/exampleSite/content/en/shortcodes/audio/_index.md new file mode 100644 index 0000000..7c669c9 --- /dev/null +++ b/exampleSite/content/en/shortcodes/audio/_index.md @@ -0,0 +1,48 @@ +--- +title: Audio +resources: + - name: risen + src: "risen.mp3" + title: Risen + params: + credits: "[Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)" +--- + +The audio shortcode allows you to embed audio files. + +## Usage + +Define your resources in the page front matter, custom parameter `params.credits` is optional. + + + +```md +--- +resources: + - name: risen + src: "risen.mp3" + title: Risen + params: + credits: "[Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)" +--- + +{{* audio name="risen" */>}} +``` + +### Attributes + + + +{{< propertylist name=shortcode-audio sort=name order=asc >}} + + + + + +## Example + + + +{{< audio name="risen" >}} + + diff --git a/exampleSite/content/en/shortcodes/audio/risen.mp3 b/exampleSite/content/en/shortcodes/audio/risen.mp3 new file mode 100644 index 0000000..edb7346 Binary files /dev/null and b/exampleSite/content/en/shortcodes/audio/risen.mp3 differ diff --git a/exampleSite/data/properties/shortcode-audio.yaml b/exampleSite/data/properties/shortcode-audio.yaml new file mode 100644 index 0000000..1c41489 --- /dev/null +++ b/exampleSite/data/properties/shortcode-audio.yaml @@ -0,0 +1,6 @@ +--- +properties: + - name: name + type: string + description: Name of the audio resource defined in page front matter. + required: true diff --git a/layouts/shortcodes/audio.html b/layouts/shortcodes/audio.html new file mode 100644 index 0000000..b809cba --- /dev/null +++ b/layouts/shortcodes/audio.html @@ -0,0 +1,23 @@ +{{- $source := ($.Page.Resources.ByType "audio").GetMatch (printf "%s" (.Get "name")) }} +{{- $customAlt := .Get "alt" }} + + +{{- with $source }} + {{- $caption := default .Title $customAlt }} + +