diff options
author | tdro <tdro@noreply.example.com> | 2022-06-12 03:50:28 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-06-12 03:50:28 -0400 |
commit | 878408fb5c8cfc17e695ae846fa0a13c5f0bb848 (patch) | |
tree | c38a579d2f8a9f44abb83e040fb778178ef9b66f /themes/default/layouts/shortcodes | |
parent | 55abba4c9703d0e5f0ec3c3770d723c22d40a161 (diff) | |
download | canory-878408fb5c8cfc17e695ae846fa0a13c5f0bb848.tar.gz canory-878408fb5c8cfc17e695ae846fa0a13c5f0bb848.tar.bz2 canory-878408fb5c8cfc17e695ae846fa0a13c5f0bb848.zip |
themes/default/layouts/partials/video-container: Source of truth for video embeds
Static videos with cached copy. Convert imgur short code into a
video short code helper. Replace dynamic embed with static.
Diffstat (limited to 'themes/default/layouts/shortcodes')
-rw-r--r-- | themes/default/layouts/shortcodes/imgur-video.html | 34 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/video.html | 47 |
2 files changed, 32 insertions, 49 deletions
diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/imgur-video.html index bdb087d..72c7af3 100644 --- a/themes/default/layouts/shortcodes/imgur-video.html +++ b/themes/default/layouts/shortcodes/imgur-video.html @@ -1,20 +1,16 @@ -{{- $id := default "uVrh84e" (.Get "id" | default (.Get 0)) -}} -{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} +{{- $id := default "rQIb4Vw" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default "Imgur Gif" (.Get "caption" | default (.Get 2)) -}} -<imgur-video> - <blockquote - class="imgur-embed-pub" - lang="en" - data-id="{{ $id }}" - data-context="false"> - <a href="//imgur.com/{{ $id }}"></a> - </blockquote> - <script async src="//s.imgur.com/min/embed.js"></script> - <noscript> - <a href="//imgur.com/{{ $id }}">imgur.com/{{ $id }}</a> - </noscript> - <footer> - {{ $title | markdownify }} - ({{ print "[Link](https://imgur.com/" $id ")" | markdownify }}) - </footer> -</imgur-video> +{{- $controls := default "controls autoplay loop muted playsinline" + (.Get "controls" | default (.Get 3)) +-}} + +{{- partial "video-container.html" + (dict + "Author" .Page.Section + "Caption" $caption + "Controls" $controls + "Source" (print "https://i.imgur.com/" $id ".mp4") + ) +-}} diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index 5f6d8c3..4eb5fb6 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -7,38 +7,25 @@ {{- $width := default "" (.Get "width" | default (.Get 2)) -}} {{- $height := default "" (.Get "height" | default (.Get 3)) -}} {{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} -{{- $controls := default "" (.Get "controls" | default (.Get 5)) -}} +{{- $controls := default "controls" (.Get "controls" | default (.Get 5)) -}} {{- $caption := default "`HTML5` Video" (.Get "caption" | default (.Get 6)) -}} {{- $title := default "HTML5 Video" (.Get "title" | default (.Get 7)) -}} {{- $start := default "" (.Get "start" | default (.Get 8)) -}} {{- $end := default "" (.Get "end" | default (.Get 9)) -}} -{{- $path := replace (path.Dir $source) ":/" "://" 1 -}} -{{- $base := split (path.Base $source) "." -}} -{{- $name := index (first (sub (len $base) 1) $base) 0 -}} -{{- $mime := path.Ext $source -}} -{{- $source = print $path "/" $name -}} - -<video-container> - <video - title="{{ $title }}" - preload="{{ $preload }}" - poster="{{ $poster }}" - width="{{ $width }}" - height="{{ $height }}" - controls="{{ $controls | safeHTMLAttr }}"> - <source src="{{ $source}}{{ $mime }}#t={{ $start }},{{ $end }}" type="video/{{ $mime }}"> - <source src="{{ $source }}.mp4#t={{ $start}},{{ $end }}" type="video/mp4"> - <source src="{{ $source }}.webm#t={{ $start }},{{ $end }}" type="video/webm"> - <source src="{{ $source }}.flv#t={{ $start }},{{ $end }}" type="video/flv"> - <source src="{{ $source }}.ogv#t={{ $start }},{{ $end }}" type="video/ogv"> - <p> - Sorry, your browser does not support embedded videos. Here is a - <a href="{{ $source }}{{ $mime }}#t={{ $start }},{{ $end }}">link to the video</a> instead. - </p> - </video> - <footer> - {{ $caption | markdownify }} - ({{ print "[Link](" $source $mime ")" | markdownify }}) - </footer> -</video-container> +{{- partial "video-container.html" + (dict + "Author" .Page.Section + "Caption" $caption + "Controls" $controls + "End" $end + "Height" $height + "Poster" $poster + "Preload" $preload + "Source" $source + "Source" $source + "Start" $start + "Title" $title + "Width" $width + ) +-}} |