From b599ddeaddfac1ef40f6559352e779c507ba1782 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Tue, 19 Oct 2021 14:19:23 -0500 Subject: [PATCH] Use a single figure shortcode that does either image or video --- layouts/_default/single.html | 4 +++- layouts/_default/summary.html | 4 +++- layouts/partials/featured_media.html | 18 ------------------ layouts/partials/figure.html | 17 +++++++++++++++++ layouts/shortcodes/figimage.html | 22 ---------------------- layouts/shortcodes/figure.html | 2 ++ layouts/shortcodes/figvideo.html | 18 ------------------ 7 files changed, 25 insertions(+), 60 deletions(-) delete mode 100644 layouts/partials/featured_media.html create mode 100644 layouts/partials/figure.html delete mode 100644 layouts/shortcodes/figimage.html create mode 100644 layouts/shortcodes/figure.html delete mode 100644 layouts/shortcodes/figvideo.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2278fe2..bf79a5d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -18,7 +18,9 @@
{{ with .Resources.GetMatch "feature" }} -{{ partial "featured_media.html" . }} +
+ {{ partial "figure.html" . }} +
{{ end }} {{ .Content }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 469793e..ecea82a 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -12,7 +12,9 @@ {{ partial "post-metadata.html" . }} {{ with .Resources.GetMatch "feature" }} - {{ partial "featured_media.html" . }} +
+ {{ partial "figure.html" . }} +
{{ end }}
diff --git a/layouts/partials/featured_media.html b/layouts/partials/featured_media.html deleted file mode 100644 index 3212e03..0000000 --- a/layouts/partials/featured_media.html +++ /dev/null @@ -1,18 +0,0 @@ -
-
- {{ $media := . | resources.Fingerprint "sha512" }} - {{ if eq .MediaType.MainType "image" }} - {{ $media.Title }} - {{ else if eq .MediaType.MainType "video" }} - - {{ end }} - - {{ with $media.Title }} -
- {{ . | markdownify }} -
- {{ end }} -
-
diff --git a/layouts/partials/figure.html b/layouts/partials/figure.html new file mode 100644 index 0000000..1d0804f --- /dev/null +++ b/layouts/partials/figure.html @@ -0,0 +1,17 @@ +
+ {{ $media := . | resources.Fingerprint "sha512" }} + {{ if eq .MediaType.MainType "image" }} + {{ $media.Title }} + {{ else if eq .MediaType.MainType "video" }} + + {{ end }} + + {{ with $media.Title }} +
+ {{ . | markdownify }} +
+ {{ end }} +
diff --git a/layouts/shortcodes/figimage.html b/layouts/shortcodes/figimage.html deleted file mode 100644 index 49699d1..0000000 --- a/layouts/shortcodes/figimage.html +++ /dev/null @@ -1,22 +0,0 @@ -
- - {{ $img := $.Page.Resources.GetMatch (.Get "src") | resources.Fingerprint "sha512" }} - - {{ if .Get "href" }}{{ end }} - {{ . }} - {{ if .Get "href" }}{{ end }} - - {{ with $img.Title }} -
- {{ . | markdownify }} -
- {{ end }} - -
diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html new file mode 100644 index 0000000..d364561 --- /dev/null +++ b/layouts/shortcodes/figure.html @@ -0,0 +1,2 @@ +{{ $resource := $.Page.Resources.GetMatch (.Get "src") }} +{{ partial "figure.html" $resource }} diff --git a/layouts/shortcodes/figvideo.html b/layouts/shortcodes/figvideo.html deleted file mode 100644 index 6c7e041..0000000 --- a/layouts/shortcodes/figvideo.html +++ /dev/null @@ -1,18 +0,0 @@ -
- - {{ $vid := $.Page.Resources.GetMatch (.Get "src") | resources.Fingerprint "sha512" }} - - {{ if .Get "href" }}{{ end }} - - {{ if .Get "href" }}{{ end }} - - {{ with $vid.Title }} -
- {{ . | markdownify }} -
- {{ end }} - -