diff --git a/assets/css/bobastyle.css b/assets/css/bobastyle.css
index 370b23c..a56b13b 100644
--- a/assets/css/bobastyle.css
+++ b/assets/css/bobastyle.css
@@ -198,14 +198,14 @@ video {
max-width: 100%;
}
-.post-media > figure.border img,
-.post-media > figure.border video {
+.post-media > figure img,
+.post-media > figure video {
padding: 5px;
border: 7px solid var(--figure-border);
}
-figure.border img,
-figure.border video {
+figure img,
+figure video {
padding: 5px;
border: 2px solid var(--figure-border);
}
diff --git a/hugo.yaml b/hugo.yaml
index 54ddc67..3d8a3a2 100644
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -4,6 +4,8 @@ markup:
lineNos: true
goldmark:
parser:
+ # don't put
around ![]() image in markdown (used to embed any resource now)
+ wrapStandAloneImageWithinParagraph: false
attribute:
block: true
# this is enabled by default already
diff --git a/i18n/en.yaml b/i18n/en.yaml
index 41890c4..a483e10 100644
--- a/i18n/en.yaml
+++ b/i18n/en.yaml
@@ -7,6 +7,8 @@ table_of_contents:
browser_no_video_support:
other: "Your browser does not support video."
+browser_no_video_support_link:
+ other: "Click here to download it instead."
latest_posts:
other: "Latest Posts"
diff --git a/layouts/_markup/render-image.html b/layouts/_markup/render-image.html
new file mode 100644
index 0000000..42e9213
--- /dev/null
+++ b/layouts/_markup/render-image.html
@@ -0,0 +1,8 @@
+{{ with .Title }}
+
+ {{ partial "embed-resource.html" ($.Page.Resources.Get $.Destination) }}
+ {{ . }}
+
+{{ else }}
+ {{ partial "embed-resource.html" (.Page.Resources.Get .Destination) }}
+{{ end }}
diff --git a/layouts/_partials/embed-resource.html b/layouts/_partials/embed-resource.html
new file mode 100644
index 0000000..fb7d27b
--- /dev/null
+++ b/layouts/_partials/embed-resource.html
@@ -0,0 +1,21 @@
+{{ if eq .ResourceType "image" }}
+ {{/* TODO: figure out whether loading="lazy" should be set because MDN
+ * claims that images won't work with JS disabled since it would
+ * make tracking possible, but my experience says otherwise
+ */}}
+
+{{ else if eq .ResourceType "video" }}
+
+{{ else }}
+ {{/* TODO: could consider implementing more types, listed at:
+ * https://www.iana.org/assignments/media-types/media-types.xhtml
+ */}}
+ {{ errorf "Handling %q resource not supported" .ResourceType }}
+{{ end }}
diff --git a/layouts/_partials/feature-figure.html b/layouts/_partials/feature-figure.html
new file mode 100644
index 0000000..383c3b7
--- /dev/null
+++ b/layouts/_partials/feature-figure.html
@@ -0,0 +1,10 @@
+{{ with .Resources.Get "feature" }}
+
+
+ {{ partial "embed-resource.html" . }}
+ {{ with .Title }}
+ {{ . }}
+ {{ end }}
+
+
+{{ end }}
diff --git a/layouts/_partials/figure.html b/layouts/_partials/figure.html
deleted file mode 100644
index 2e4bb85..0000000
--- a/layouts/_partials/figure.html
+++ /dev/null
@@ -1,27 +0,0 @@
-{{ $hidecaption := index . "hidecaption" }}
-
-{{ if index . "noborder" }}
-
-{{ else }}
-
-{{ end }}
-
- {{ with index . "src" }}
- {{ if eq .MediaType.MainType "image" }}
-
- {{ else if eq .MediaType.MainType "video" }}
-
- {{ end }}
-
- {{ if not $hidecaption }}
- {{ with .Title }}
-
- {{ . | markdownify }}
-
- {{ end }}
- {{ end }}
- {{ end }}
-
diff --git a/layouts/_partials/remote_figure.html b/layouts/_partials/remote_figure.html
deleted file mode 100644
index 855e020..0000000
--- a/layouts/_partials/remote_figure.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{{ $hidecaption := index . "hidecaption" }}
-{{ $type := index . "type" }}
-{{ $src := index . "src" }}
-{{ $alt := index . "alt" }}
-
-{{ if index . "border" }}
-
-{{ else }}
-
-{{ end }}
-
- {{ if eq $type "image" }}
-
- {{ else if eq $type "video" }}
-
- {{ end }}
-
- {{ if not $hidecaption }}
- {{ with $alt }}
-
- {{ . | markdownify }}
-
- {{ end }}
- {{ end }}
-
diff --git a/layouts/_shortcodes/figure.html b/layouts/_shortcodes/figure.html
index 61d25d0..96c1b38 100644
--- a/layouts/_shortcodes/figure.html
+++ b/layouts/_shortcodes/figure.html
@@ -1,15 +1,8 @@
-{{ $resource := .Page.Resources.GetMatch (.Get "src") }}
-
-{{ $noborder := false }}
-{{ if .Get "noborder" }}
- {{ $noborder = true }}
-{{ end }}
-
-{{ $hidecaption := false }}
-{{ if .Get "hidecaption" }}
- {{ $hidecaption = true }}
-{{ end }}
-
- {{ partial "figure.html" (dict "src" $resource "noborder" $noborder "hidecaption" $hidecaption) }}
+
+ {{ .Inner }}
+ {{ with .Get "caption" }}
+ {{ . }}
+ {{ end }}
+
diff --git a/layouts/_shortcodes/remote-figure.html b/layouts/_shortcodes/remote-figure.html
deleted file mode 100644
index 4756e3c..0000000
--- a/layouts/_shortcodes/remote-figure.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{{ $border := false }}
-{{ if .Get "border" }}
- {{ $border = true }}
-{{ end }}
-
-{{ $hidecaption := false }}
-{{ if .Get "hidecaption" }}
- {{ $hidecaption = true }}
-{{ end }}
-
-
- {{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" (.Get "type") "alt" (.Get "alt")) }}
-
diff --git a/layouts/single.html b/layouts/single.html
index 36dca8c..d6455c2 100644
--- a/layouts/single.html
+++ b/layouts/single.html
@@ -22,11 +22,7 @@
{{ end }}
- {{ with .Resources.GetMatch "feature" }}
-
- {{ partial "figure.html" (dict "src" .) }}
-
- {{ end }}
+ {{ partial "feature-figure.html" . }}
{{ .Content }}
diff --git a/layouts/summary.html b/layouts/summary.html
index a47a616..b690259 100644
--- a/layouts/summary.html
+++ b/layouts/summary.html
@@ -6,11 +6,7 @@
{{ partial "page-metadata/post-short.html" . }}
-{{ with .Resources.GetMatch "feature" }}
-
- {{ partial "figure.html" (dict "src" .) }}
-
-{{ end }}
+{{ partial "feature-figure.html" . }}
{{ partial "description-or-summary.html" . }}