File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed
content/blog/say-hello-to-doks Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,39 @@ weight: 50
9
9
images : ["say-hello-to-doks.png"]
10
10
contributors : ["Henk Verlinde"]
11
11
---
12
+
13
+ ## Video shortcode
14
+
15
+ ### Usage
16
+
17
+ ``` md
18
+ {{</* video ratio="16x9" attributes="controls autoplay muted" webm-src="videos/flower.webm" mp4-src="videos/flower.mp4" */>}}
19
+ ```
20
+
21
+ | Parameters | Values |
22
+ | ----------| -------------| ------|
23
+ | ratio | <1x1 \| 4x3 \| 16x9 \| 21x9> |
24
+ | attributes | [[ Attributes] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attributes )] |
25
+ | webm-src | [ path/to/file.webm] |
26
+ | mp4-src | [ path/to/file.mp4] |
27
+ {.table-striped}
28
+
29
+ ### Renders
30
+
31
+ ``` html
32
+ <div class =" ratio ratio-16x9" >
33
+ <video controls autoplay muted >
34
+ <source src =" /videos/flower.webm" type =" video/webm" >
35
+ <source src =" /videos/flower.mp4" type =" video/mp4" >
36
+ Sorry, your browser doesn't support embedded videos.
37
+ </video >
38
+ </div >
39
+ ```
40
+
41
+ {{< video ratio="16x9" attributes="controls autoplay muted" webm-src="videos/flower.webm" mp4-src="/videos/flower.mp4" >}}
42
+
43
+ ## Resources
44
+
45
+ - [ \< video\> : The Video Embed element] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video )
46
+ - [ Ratios] ( https://getbootstrap.com/docs/5.0/helpers/ratio/ )
47
+ - [ Custom aspect ratios] ( https://getbootstrap.com/docs/5.0/helpers/ratio/#sass-map )
Original file line number Diff line number Diff line change
1
+ < div class ="ratio ratio-{{ with .Get "ratio " }}{{.}}{{ end }}">
2
+ < video {{ with .Get "attributes" }} {{ . | safeHTMLAttr }}{{ end }}>
3
+ {{ with .Get "webm-src" -}}
4
+ < source src ="{{ . | relURL }} " type ="video/webm ">
5
+ {{ end -}}
6
+ {{ with .Get "mp4-src" -}}
7
+ < source src ="{{ . | relURL }} " type ="video/mp4 ">
8
+ {{ end -}}
9
+ Sorry, your browser doesn't support embedded videos.
10
+ </ video >
11
+ </ div >
You can’t perform that action at this time.
0 commit comments