Commit 230075d 1 parent f9ff25f commit 230075d Copy full SHA for 230075d
File tree 5 files changed +87
-1
lines changed
content/en/shortcodes/audio
5 files changed +87
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Audio
3
+ resources :
4
+ - name : risen
5
+ src : " risen.mp3"
6
+ title : Risen
7
+ params :
8
+ credits : " [Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)"
9
+ ---
10
+
11
+ The audio shortcode allows you to embed audio files.
12
+
13
+ ## Usage
14
+
15
+ Define your resources in the page front matter, custom parameter ` params.credits ` is optional.
16
+
17
+ <!-- spellchecker-disable -->
18
+
19
+ ``` md
20
+ ---
21
+ resources:
22
+ - name: risen
23
+ src: "risen.mp3"
24
+ title: Risen
25
+ params:
26
+ credits: "[Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)"
27
+ ---
28
+
29
+ {{</* audio name="risen" */>}}
30
+ ```
31
+
32
+ ### Attributes
33
+
34
+ <!-- prettier-ignore-start -->
35
+ <!-- spellchecker-disable -->
36
+ {{< propertylist name=shortcode-audio sort=name order=asc >}}
37
+ <!-- spellchecker-enable -->
38
+ <!-- prettier-ignore-end -->
39
+
40
+ <!-- spellchecker-enable -->
41
+
42
+ ## Example
43
+
44
+ <!-- spellchecker-disable -->
45
+
46
+ {{< audio name="risen" >}}
47
+
48
+ <!-- spellchecker-enable -->
Original file line number Diff line number Diff line change
1
+ ---
2
+ properties :
3
+ - name : name
4
+ type : string
5
+ description : Name of the audio resource defined in page front matter.
6
+ required : true
Original file line number Diff line number Diff line change
1
+ {{- $source := ($.Page.Resources.ByType "audio").GetMatch (printf "%s" (.Get "name")) }}
2
+ {{- $customAlt := .Get "alt" }}
3
+
4
+
5
+ {{- with $source }}
6
+ {{- $caption := default .Title $customAlt }}
7
+
8
+ < div class ="flex justify-center ">
9
+ < figure class ="gdoc-markdown__figure ">
10
+ < audio controls class ="player " preload ="auto ">
11
+ < source src ="{{ .Permalink }} " type ="audio/mpeg ">
12
+ </ audio >
13
+ {{- with $caption }}
14
+ < figcaption >
15
+ {{ . }}
16
+ {{- with $source.Params.credits }}
17
+ {{ printf " (%s)" . | $.Page.RenderString }}
18
+ {{- end }}
19
+ </ figcaption >
20
+ {{- end }}
21
+ </ figure >
22
+ </ div >
23
+ {{- end }}
Original file line number Diff line number Diff line change 100
100
max-width : 100% ;
101
101
height : auto ;
102
102
}
103
+
104
+ & :has (audio ) {
105
+ width : 100% ;
106
+
107
+ audio {
108
+ width : 100% ;
109
+ }
110
+ }
103
111
}
104
112
105
113
img {
109
117
110
118
blockquote {
111
119
margin : defaults .$padding-16 0 ;
112
- padding : defaults .$padding-8 defaults .$padding-16 defaults .$padding-8 (defaults .$padding-16 - defaults .$padding-4 ); // to keep total left space 16dp
120
+ padding : defaults .$padding-8 defaults .$padding-16 defaults .$padding-8
121
+ (defaults .$padding-16 - defaults .$padding-4 ); // to keep total left space 16dp
113
122
114
123
border-left : defaults .$border-4 solid var (--accent-color );
115
124
border-radius : defaults .$border-radius ;
You can’t perform that action at this time.
0 commit comments