aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-09-05 15:51:18 -0400
committertdro <tdro@noreply.example.com>2022-09-05 15:51:18 -0400
commit2d3bfb0ddc97bb6c147965bb1bb8a515c96f1192 (patch)
treef2e5a6a75b57dcd18067131458f9eca8771bf862
parent04faae81db518593ad1b05559079f45c4c9c5ab0 (diff)
downloadcanory-2d3bfb0ddc97bb6c147965bb1bb8a515c96f1192.tar.gz
canory-2d3bfb0ddc97bb6c147965bb1bb8a515c96f1192.tar.bz2
canory-2d3bfb0ddc97bb6c147965bb1bb8a515c96f1192.zip
themes/default/layouts/shortcodes/video: Set orientation
-rw-r--r--assets/css/default.css10
-rw-r--r--themes/default/layouts/partials/video-container.html4
-rw-r--r--themes/default/layouts/shortcodes/video.html46
3 files changed, 37 insertions, 23 deletions
diff --git a/assets/css/default.css b/assets/css/default.css
index dbb0592..4fa6ece 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -281,6 +281,7 @@ blockquote p span {
video {
border-radius: 0.5rem;
+ background-color: #000;
}
video:hover {
@@ -288,6 +289,15 @@ video:hover {
box-shadow: 0 0 14px var(--shadow);
}
+video[data-orientation="portrait"] {
+ width: 50%;
+}
+
+video-container {
+ display: block;
+ text-align: center;
+}
+
kbd {
background-color: #eee;
border-radius: 0.25rem;
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html
index d114332..cf5c20e 100644
--- a/themes/default/layouts/partials/video-container.html
+++ b/themes/default/layouts/partials/video-container.html
@@ -5,8 +5,9 @@
{{- $immutable := print (.RelURL | humanize | urlize) "-" (.Source | sha256 | truncate 8 "") -}}
{{- $extension := path.Ext .Source -}}
{{- $fileCache := print $.Author "/media/" $immutable $extension -}}
+{{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}}
-{{- if not (fileExists (path.Join "public/" $fileCache)) -}}
+{{- if $notCached -}}
{{- with $remote := resources.GetRemote .Source -}}
{{- with .Err -}}
{{- if fileExists $public -}}
@@ -30,6 +31,7 @@
<video
title="{{ .Title }}"
preload="{{ .Preload }}"
+ data-orientation="{{ .Orientation }}"
{{ with .Poster }} poster="{{ . }}" {{ end -}}
{{ with .Width }} width="{{ . }}" {{ end -}}
{{ with .Height }} height="{{ . }}" {{ end -}}
diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html
index c7a2999..1aadbbd 100644
--- a/themes/default/layouts/shortcodes/video.html
+++ b/themes/default/layouts/shortcodes/video.html
@@ -3,30 +3,32 @@
"https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4"
(.Get "source" | default (.Get 0))
-}}
-{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}}
-{{- $width := default "" (.Get "width" | default (.Get 2)) -}}
-{{- $height := default "" (.Get "height" | default (.Get 3)) -}}
-{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}}
-{{- $options := default "controls" (.Get "options" | default (.Get 5)) -}}
-{{- $caption := default "Untitled Video" (.Get "caption" | default (.Get 6)) -}}
-{{- $title := default $caption (.Get "title" | default (.Get 7)) -}}
-{{- $start := default "" (.Get "start" | default (.Get 8)) -}}
-{{- $end := default "" (.Get "end" | default (.Get 9)) -}}
+{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}}
+{{- $width := default "" (.Get "width" | default (.Get 2)) -}}
+{{- $height := default "" (.Get "height" | default (.Get 3)) -}}
+{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}}
+{{- $options := default "controls" (.Get "options" | default (.Get 5)) -}}
+{{- $caption := default "Untitled Video" (.Get "caption" | default (.Get 6)) -}}
+{{- $title := default $caption (.Get "title" | default (.Get 7)) -}}
+{{- $start := default "" (.Get "start" | default (.Get 8)) -}}
+{{- $end := default "" (.Get "end" | default (.Get 9)) -}}
+{{- $orientation := default "landscape" (.Get "orientation" | default (.Get 10)) -}}
{{- partial "video-container.html"
(dict
- "Author" .Page.Section
- "Caption" $caption
- "End" $end
- "Height" $height
- "Options" $options
- "Poster" $poster
- "Preload" $preload
- "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink)
- "Source" $source
- "Source" $source
- "Start" $start
- "Title" $title
- "Width" $width
+ "Author" .Page.Section
+ "Caption" $caption
+ "End" $end
+ "Height" $height
+ "Options" $options
+ "Poster" $poster
+ "Preload" $preload
+ "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink)
+ "Source" $source
+ "Source" $source
+ "Start" $start
+ "Title" $title
+ "Width" $width
+ "Orientation" $orientation
)
-}}