blob: 791e3dac2b46c7cb5efa7be79f63baec8686ef7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
{{- $url := "www.youtube-nocookie.com" -}}
{{- $id := default "aqz-KE-bpKQ" (.Get "id" | default (.Get 0)) -}}
{{- $title := default "YouTube Video" (.Get "title" | default (.Get 1)) -}}
{{- $start := default "" (.Get "start" | default (.Get 2)) -}}
{{- $end := default "" (.Get "end" | default (.Get 3)) -}}
{{- $muted := default "" (.Get "muted" | default (.Get 4)) -}}
{{- if (and $start $end) -}}
{{ $start = print "&start=" $start }}
{{ $end = print "&end=" $end }}
{{- end -}}
{{- if $muted -}}
{{ $muted = "&mute=1" }}
{{- end -}}
<youtube-video>
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<iframe loading="lazy" sandbox="allow-scripts allow-same-origin"
src="https://{{ $url }}/embed/{{ $id }}{{ "?controls=1" }}{{ $start }}{{ $end }}{{ $muted }}"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"
allowfullscreen title="{{ $title }}">
</iframe>
</div>
<figcaption>
{{ $title | markdownify }}:
{{ print "[Link](https://www.youtube.com/watch?v=" $id ")" | markdownify }}
</figcaption>
</youtube-video>
|