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.html13
1 files changed, 6 insertions, 7 deletions
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html
index af1a50d..9e28e3d 100644
--- a/themes/default/layouts/partials/video-container.html
+++ b/themes/default/layouts/partials/video-container.html
@@ -6,8 +6,8 @@
{{- $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)) -}}
+{{- $storage := print $.Author "/media/" $immutable $extension -}}
+{{- $cached := fileExists (path.Join "public/" $storage) -}}
{{- if .Start -}}
{{- $timestamp = print "#t=" .Start -}}
@@ -21,7 +21,7 @@
{{- $timestamp = print "#t=" .Start "," .End -}}
{{- end -}}
-{{- if $notCached -}}
+{{- if not $cached -}}
{{- with $remote := cond (default true $.Context.Site.Params.site.offline) false (resources.GetRemote .Source) -}}
{{- with .Err -}}
{{- warnf "Video fetch %s" . -}}
@@ -29,16 +29,15 @@
{{- $caption = "No local video data found for source" -}}
{{- end -}}
{{- else -}}
- {{- $cache = . | resources.Copy $fileCache -}}
+ {{- $cache = $remote | resources.Copy $storage -}}
{{- $cache = $cache.Permalink -}}
{{- end -}}
{{- else -}}
{{- $caption = "Unable to load remote source data" -}}
{{- end -}}
{{- else -}}
- {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}}
- {{- $cache = $cache.Content | resources.FromString $fileCache -}}
- {{- $cache = $cache.Permalink -}}
+ {{- with $cache = resources.Get (path.Join "public/" $storage) -}}
+ {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}}
{{- end -}}
{{- end -}}