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)" +--- + +{{}} +``` + +### 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 }} + +
+
+ + {{- with $caption }} +
+ {{ . }} + {{- with $source.Params.credits }} + {{ printf " (%s)" . | $.Page.RenderString }} + {{- end }} +
+ {{- end }} +
+
+{{- end }} diff --git a/src/sass/_markdown.scss b/src/sass/_markdown.scss index f734469..7333acd 100644 --- a/src/sass/_markdown.scss +++ b/src/sass/_markdown.scss @@ -100,6 +100,14 @@ max-width: 100%; height: auto; } + + &:has(audio) { + width: 100%; + + audio { + width: 100%; + } + } } img { @@ -109,7 +117,8 @@ blockquote { margin: defaults.$padding-16 0; - padding: defaults.$padding-8 defaults.$padding-16 defaults.$padding-8 (defaults.$padding-16 - defaults.$padding-4); //to keep total left space 16dp + padding: defaults.$padding-8 defaults.$padding-16 defaults.$padding-8 + (defaults.$padding-16 - defaults.$padding-4); //to keep total left space 16dp border-left: defaults.$border-4 solid var(--accent-color); border-radius: defaults.$border-radius;