{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
- {{ with $feature }}
+ {{ if $featureImg }}
-
+ {{ $alt := $.Params.featureAlt | default $.Params.coverAlt | default "" }}
+ {{ partial "picture.html" (dict "context" . "src" $feature "alt" $alt "class" "mb-6 -mt-4 rounded-md") }}
{{ with $.Params.coverCaption }}
{{ . | markdownify }}
{{ end }}
diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html
new file mode 100644
index 00000000..207f5d07
--- /dev/null
+++ b/layouts/partials/picture.html
@@ -0,0 +1,80 @@
+{{ $url := urls.Parse .src }}
+{{ $altText := .alt }}
+{{ $class := .class | default "mx-auto my-0 rounded-md" }}
+
+{{ $lazyLoad := .context.Page.Site.Params.enableImageLazyLoading | default true }}
+{{ $webp := .context.Page.Site.Params.enableWebp | default true }}
+
+{{ if findRE "^https?" $url.Scheme }}
+
+{{ else }}
+ {{ $resource := "" }}
+ {{ if .context.Page.Resources.GetMatch ($url.String) }}
+ {{ $resource = .context.Page.Resources.GetMatch ($url.String) }}
+ {{ else if resources.GetMatch ($url.String) }}
+ {{ $resource = resources.Get ($url.String) }}
+ {{ end }}
+ {{ with $resource }}
+
+ {{ else }}
+
+ {{ end }}
+{{ end }}
+
+
diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
index 7028c6c1..d04617eb 100644
--- a/layouts/shortcodes/figure.html
+++ b/layouts/shortcodes/figure.html
@@ -1,50 +1,14 @@
{{ if .Get "default" }}
{{ template "_internal/shortcodes/figure.html" . }}
{{ else }}
- {{ $url := urls.Parse (.Get "src") }}
- {{ $altText := .Get "alt" }}
+ {{ $src := .Get "src" }}
+ {{ $alt := .Get "alt" }}
{{ $caption := .Get "caption" }}
{{ $href := .Get "href" }}
{{ $class := .Get "class" }}