Skip to content

Commit 1c75145

Browse files
committed
Add video playlist
1 parent 20b3f08 commit 1c75145

3 files changed

Lines changed: 60 additions & 6 deletions

File tree

content/video/_index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Videos
33
weight: 48
44
---
55

6-
Pi4J has been presented at many conferences, events, live streams, and more. Here is a selection of the videos which are available online...
6+
Pi4J has been presented at many conferences, events, live streams, and more. Here on the Pi4J website, you can find a selection of the videos which are available online. Or check this [YouTube playlist](https://www.youtube.com/playlist?list=PL-3Bf_FLNZLAzGmNwcMoj9cycDjyGk-15):
7+
8+
{{< youtube-playlist id="PL-3Bf_FLNZLAzGmNwcMoj9cycDjyGk-15" title="Pi4J YouTube Playlist" >}}
79

810
{{% children depth="3" sort="date" order="desc" %}}
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
22
{{- if not $pc.Disable -}}
33
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
4-
{{- $id := .Get "id" | default (.Get 0) -}}
5-
{{- $class := .Get "class" | default (.Get 1) -}}
6-
{{- $title := .Get "title" | default "YouTube Video" }}
4+
{{- $id := "" -}}
5+
{{- $class := "" -}}
6+
{{- $title := "YouTube Playlist" -}}
7+
{{- $autoplay := "0" -}}
8+
{{- $start := "0" -}}
9+
{{- if .IsNamedParams -}}
10+
{{- $id = .Get "id" -}}
11+
{{- $class = .Get "class" | default "" -}}
12+
{{- $title = .Get "title" | default "YouTube Playlist" -}}
13+
{{- $autoplay = cond (eq (printf "%v" (.Get "autoplay" | default false)) "true") "1" "0" -}}
14+
{{- $start = printf "%v" (.Get "start" | default 0) -}}
15+
{{- else -}}
16+
{{- $id = .Get 0 -}}
17+
{{- $class = .Get 1 | default "" -}}
18+
{{- $title = .Get 2 | default "YouTube Playlist" -}}
19+
{{- end -}}
720
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
8-
<iframe src="https://{{ $ytHost }}/embed/videoseries?list={{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}&autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="{{ $title }}"></iframe>
21+
<iframe src="https://{{ $ytHost }}/embed/videoseries?list={{ $id }}&autoplay={{ $autoplay }}&start={{ $start }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="{{ $title }}"></iframe>
922
</div>
10-
{{ end -}}
23+
{{ end -}}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
2+
{{- if not $pc.Disable -}}
3+
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
4+
{{- $id := "" -}}
5+
{{- $class := "" -}}
6+
{{- $title := "YouTube video" -}}
7+
{{- $autoplay := "0" -}}
8+
{{- $controls := "1" -}}
9+
{{- $end := "0" -}}
10+
{{- $loop := "0" -}}
11+
{{- $mute := "0" -}}
12+
{{- $start := "0" -}}
13+
{{- if .IsNamedParams -}}
14+
{{- $id = .Get "id" -}}
15+
{{- $class = .Get "class" | default "" -}}
16+
{{- $title = .Get "title" | default "YouTube video" -}}
17+
{{- $autoplay = cond (eq (printf "%v" (.Get "autoplay" | default false)) "true") "1" "0" -}}
18+
{{- $controls = cond (eq (printf "%v" (.Get "controls" | default true)) "true") "1" "0" -}}
19+
{{- $end = printf "%v" (.Get "end" | default 0) -}}
20+
{{- $loop = cond (eq (printf "%v" (.Get "loop" | default false)) "true") "1" "0" -}}
21+
{{- $mute = cond (eq (printf "%v" (.Get "mute" | default false)) "true") "1" "0" -}}
22+
{{- $start = printf "%v" (.Get "start" | default 0) -}}
23+
{{- else -}}
24+
{{- $id = .Get 0 -}}
25+
{{- $class = .Get 1 | default "" -}}
26+
{{- $title = .Get 2 | default "YouTube video" -}}
27+
{{- end -}}
28+
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
29+
<iframe
30+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
31+
allowfullscreen="allowfullscreen"
32+
loading="eager"
33+
referrerpolicy="strict-origin-when-cross-origin"
34+
src="https://{{ $ytHost }}/embed/{{ $id }}?autoplay={{ $autoplay }}&amp;controls={{ $controls }}&amp;end={{ $end }}&amp;loop={{ $loop }}&amp;mute={{ $mute }}&amp;start={{ $start }}{{ if eq $loop "1" }}&amp;playlist={{ $id }}{{ end }}"
35+
{{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"{{ end }}
36+
title="{{ $title }}"></iframe>
37+
</div>
38+
{{- end -}}
39+

0 commit comments

Comments
 (0)