aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/video-container.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/partials/video-container.html')
-rw-r--r--themes/default/layouts/partials/video-container.html21
1 files changed, 18 insertions, 3 deletions
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html
index 488d4ec..520a16d 100644
--- a/themes/default/layouts/partials/video-container.html
+++ b/themes/default/layouts/partials/video-container.html
@@ -1,12 +1,22 @@
{{- $cache := "" -}}
+{{- $source := "" -}}
{{- $timestamp := "" -}}
{{- $caption := .Caption -}}
+{{- $remote := .Remote -}}
{{- $public := print "public/" .Source -}}
{{- $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 .Start -}}
+ {{- $timestamp = print "#t=" .Start -}}
+{{- end -}}
+
+{{- if .End -}}
+ {{- $timestamp = print "#t=," .End -}}
+{{- end -}}
+
{{- if and .Start .End -}}
{{- $timestamp = print "#t=" .Start "," .End -}}
{{- end -}}
@@ -14,8 +24,7 @@
{{- if $notCached -}}
{{- with $remote := resources.GetRemote .Source -}}
{{- with .Err -}}
- {{- if fileExists $public -}}
- {{- else -}}
+ {{- if not (fileExists $public) -}}
{{- $caption = "No local video data found for source" -}}
{{- end -}}
{{- else -}}
@@ -31,6 +40,12 @@
{{- $cache = $cache.Permalink -}}
{{- end -}}
+{{- $source = $cache -}}
+
+{{- if .Remote -}}
+ {{- $source = .Source -}}
+{{- end -}}
+
<video-container>
<video
title="{{ .Title }}"
@@ -40,7 +55,7 @@
{{ with .Width }} width="{{ . }}" {{ end -}}
{{ with .Height }} height="{{ . }}" {{ end -}}
{{ .Options | safeHTMLAttr }}>
- <source src="{{ or .Source .Cache }}{{ $timestamp }}">
+ <source src="{{ $source }}{{ $timestamp }}">
{{ print "Video: " $caption "." | markdownify }}
<p>
Sorry, your browser does not support embedded videos. Here is a