aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-22 02:19:54 -0500
committertdro <tdro@noreply.example.com>2022-12-22 02:19:54 -0500
commitf02259a87f5be78ac3611a2341bed83306e94223 (patch)
treed2f80015f7e548a7cd34813f633b2429e64b10df
parentb7acf1be64b6845a0b826a1af4c0db62e70e9aba (diff)
downloadcanory-f02259a87f5be78ac3611a2341bed83306e94223.tar.gz
canory-f02259a87f5be78ac3611a2341bed83306e94223.tar.bz2
canory-f02259a87f5be78ac3611a2341bed83306e94223.zip
themes/default/layouts/shortcodes/video: Add RSS version
Unify other helpers
-rw-r--r--themes/default/layouts/partials/function-content.html3
-rw-r--r--themes/default/layouts/partials/video-container.html7
-rw-r--r--themes/default/layouts/shortcodes/imgur-video.html15
-rw-r--r--themes/default/layouts/shortcodes/video.html2
-rw-r--r--themes/default/layouts/shortcodes/video.rss.xml29
5 files changed, 41 insertions, 15 deletions
diff --git a/themes/default/layouts/partials/function-content.html b/themes/default/layouts/partials/function-content.html
index 9ad5a1a..59776aa 100644
--- a/themes/default/layouts/partials/function-content.html
+++ b/themes/default/layouts/partials/function-content.html
@@ -1,7 +1,6 @@
{{- $context := . -}}
{{- $content := $context.Content -}}
{{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}}
-{{- $empty := eq (len $content) 0 -}}
{{-
$content = $content |
@@ -20,7 +19,7 @@
{{- $content = replace $content $brokenBlockquote $fixedBlockquote -}}
{{- end -}}
-{{- if $empty -}}
+{{- if not $content -}}
{{- $content = "This message contains no content." -}}
{{- end -}}
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html
index caf89d3..bae0cbb 100644
--- a/themes/default/layouts/partials/video-container.html
+++ b/themes/default/layouts/partials/video-container.html
@@ -36,9 +36,10 @@
{{- $caption = "No remote video data found for source" -}}
{{- end -}}
{{- else -}}
- {{- $cache = resources.Get (path.Join "public/" $fileCache) -}}
- {{- $cache = $cache.Content | resources.FromString $fileCache -}}
- {{- $cache = $cache.Permalink -}}
+ {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}}
+ {{- $cache = $cache.Content | resources.FromString $fileCache -}}
+ {{- $cache = $cache.Permalink -}}
+ {{- end -}}
{{- end -}}
{{- $source = $cache -}}
diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/imgur-video.html
index a6d637a..9bc130f 100644
--- a/themes/default/layouts/shortcodes/imgur-video.html
+++ b/themes/default/layouts/shortcodes/imgur-video.html
@@ -1,17 +1,14 @@
{{- $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)) -}}
+{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
{{- $options := default "controls autoplay loop muted playsinline"
(.Get "options" | default (.Get 3))
-}}
-{{- partial "video-container.html"
- (dict
- "Author" .Page.Section
- "Caption" $caption
- "Options" $options
- "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink)
- "Source" (print "https://i.imgur.com/" $id ".mp4")
- )
+{{- $source := print "https://i.imgur.com/" $id ".mp4" -}}
+
+{{- printf `{{< video source="%s" title="%s" caption="%s" options="%s" >}}`
+ $source $title $caption $options
+ | markdownify
-}}
diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html
index 64de78f..18065f8 100644
--- a/themes/default/layouts/shortcodes/video.html
+++ b/themes/default/layouts/shortcodes/video.html
@@ -1,5 +1,5 @@
{{-
- $source := default
+ $source := default
"https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4"
(.Get "source" | default (.Get 0))
-}}
diff --git a/themes/default/layouts/shortcodes/video.rss.xml b/themes/default/layouts/shortcodes/video.rss.xml
new file mode 100644
index 0000000..cff5974
--- /dev/null
+++ b/themes/default/layouts/shortcodes/video.rss.xml
@@ -0,0 +1,29 @@
+{{-
+ $source := default
+ "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)) -}}
+{{- $orientation := default "landscape" (.Get "orientation" | default (.Get 10)) -}}
+{{- $remote := default "" (.Get "remote" | default (.Get 11)) -}}
+
+<p>
+ <b>
+ <a
+ title="{{ $title }}"
+ href="{{ $source }}"
+ >
+ {{- $caption -}}
+ </a>
+ </b>
+ <br>
+ <span>{{ $caption }}</span>
+</p>