diff --git a/layouts/partials/blocks/templates/video.html b/layouts/partials/blocks/templates/video.html index d2b7a939ae2c2036fabd04f548b004f4f7ee5886..547dbdb5e851d60e14ea92c45de1dd4231002b89 100644 --- a/layouts/partials/blocks/templates/video.html +++ b/layouts/partials/blocks/templates/video.html @@ -19,8 +19,11 @@ {{ end }} <div class="video"> - {{ $partial := printf "blocks/templates/video/%s" .video.platform }} - {{ partial $partial . }} + {{ if eq .video.platform "default" }} + {{ partial "PrepareHTML" .video.iframe }} + {{ else }} + {{ partial "blocks/templates/video/lazy-container" .video }} + {{ end }} </div> {{ end }} diff --git a/layouts/partials/blocks/templates/video/dailymotion.html b/layouts/partials/blocks/templates/video/dailymotion.html index bc36c9b12c4a119221c57497aab11a42f1ca2bc8..1b0ece4f54c822321684538f024fc514ae04818b 100644 --- a/layouts/partials/blocks/templates/video/dailymotion.html +++ b/layouts/partials/blocks/templates/video/dailymotion.html @@ -1,9 +1 @@ -<div class="lazy-video-player"> - <button class="lazy-video-player__play" title ="{{- i18n "blocks.video.play" -}}" aria-label="{{- i18n "blocks.video.play" -}}"></button> - {{ if .video.poster }} - <img src="{{ .video.poster }}" alt="{{ .video.title }}" loading="lazy"> - {{ end }} -</div> -<div class="video-container"> - <iframe data-unloaded-src="{{ .video.embed_with_defaults }}" title="{{ .video.title }}" autoplay="true" allow="autoplay; fullscreen"></iframe> -</div> \ No newline at end of file +<iframe data-unloaded-src="{{ .embed_with_defaults }}" title="{{ .title }}" autoplay="true" allow="autoplay; fullscreen"></iframe> \ No newline at end of file diff --git a/layouts/partials/blocks/templates/video/default.html b/layouts/partials/blocks/templates/video/default.html deleted file mode 100644 index 36c9e27f1bd63ac9b26fc7b9a97bdd23a8751838..0000000000000000000000000000000000000000 --- a/layouts/partials/blocks/templates/video/default.html +++ /dev/null @@ -1 +0,0 @@ -{{ partial "PrepareHTML" .video.iframe }} \ No newline at end of file diff --git a/layouts/partials/blocks/templates/video/lazy-container.html b/layouts/partials/blocks/templates/video/lazy-container.html new file mode 100644 index 0000000000000000000000000000000000000000..247b79f5dd9856bbbde022f9fd78f4e72ed01c24 --- /dev/null +++ b/layouts/partials/blocks/templates/video/lazy-container.html @@ -0,0 +1,9 @@ +<div class="lazy-video-player"> + <button class="lazy-video-player__play" title="{{- i18n "blocks.video.play" -}}" aria-label="{{- i18n "blocks.video.play" -}}"></button> + {{ if .poster }} + <img src="{{ .poster }}" alt="{{ .title }}" loading="lazy"> + {{ end }} +</div> +<div class="video-container"> + {{ partial (printf "blocks/templates/video/%s" .platform) . }} +</div> \ No newline at end of file diff --git a/layouts/partials/blocks/templates/video/peertube.html b/layouts/partials/blocks/templates/video/peertube.html index 1b879da0315d37105defb056c8cfda93a42650e6..1e92db9712a76253a50c87edf6e842e7bd4d7e97 100644 --- a/layouts/partials/blocks/templates/video/peertube.html +++ b/layouts/partials/blocks/templates/video/peertube.html @@ -1,6 +1 @@ -<div class="lazy-video-player"> - <button class="lazy-video-player__play" title ="{{- i18n "blocks.video.play" -}}" aria-label="{{- i18n "blocks.video.play" -}}"></button> -</div> -<div class="video-container"> - <iframe data-unloaded-src="{{ .video.embed_with_defaults }}" title="{{ .video.title }}" allow="autoplay; fullscreen"></iframe> -</div> \ No newline at end of file +<iframe data-unloaded-src="{{ .embed_with_defaults }}" title="{{ .title }}" allow="autoplay; fullscreen"></iframe> diff --git a/layouts/partials/blocks/templates/video/vimeo.html b/layouts/partials/blocks/templates/video/vimeo.html index 8127b3b323bb9a530512ea48bdbb805f9eab9505..1e92db9712a76253a50c87edf6e842e7bd4d7e97 100644 --- a/layouts/partials/blocks/templates/video/vimeo.html +++ b/layouts/partials/blocks/templates/video/vimeo.html @@ -1,9 +1 @@ -<div class="lazy-video-player"> - <button class="lazy-video-player__play" title ="{{- i18n "blocks.video.play" -}}" aria-label="{{- i18n "blocks.video.play" -}}"></button> - {{ if .video.poster }} - <img src="{{ .video.poster }}" alt="{{ .video.title }}" loading="lazy"> - {{ end }} -</div> -<div class="video-container"> - <iframe data-unloaded-src="{{ .video.embed_with_defaults }}" title="{{ .video.title }}" allow="autoplay; fullscreen"></iframe> -</div> \ No newline at end of file +<iframe data-unloaded-src="{{ .embed_with_defaults }}" title="{{ .title }}" allow="autoplay; fullscreen"></iframe> diff --git a/layouts/partials/blocks/templates/video/youtube.html b/layouts/partials/blocks/templates/video/youtube.html index 9cd02195cf1c43fdb2860959413680a06ccf1014..6d7f1eea801560eefa4369de3d331be18d1f36cb 100644 --- a/layouts/partials/blocks/templates/video/youtube.html +++ b/layouts/partials/blocks/templates/video/youtube.html @@ -1,9 +1 @@ -<div class="lazy-video-player"> - <button class="lazy-video-player__play" title ="{{- i18n "blocks.video.play" -}}" aria-label="{{- i18n "blocks.video.play" -}}"></button> - {{ if .video.poster }} - <img src="{{ .video.poster }}" alt="{{ .video.title }}" loading="lazy"> - {{ end }} -</div> -<div class="video-container"> - <iframe data-unloaded-src="{{ .video.embed_with_defaults }}" title="{{ video.title }}" allowfullscreen allow="autoplay"></iframe> -</div> \ No newline at end of file +<iframe data-unloaded-src="{{ .embed_with_defaults }}" title="{{ .title }}" allowfullscreen allow="autoplay"></iframe> \ No newline at end of file