aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/img.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index 56bf22f..caf9d75 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -1,9 +1,10 @@
<!-- https://gohugo.io/content-management/image-processing/ -->
<!-- Get image -->
-{{- $image := resources.GetMatch (.Get "src") -}}
+{{- $image := .Page.Resources.Get (.Get "src") -}}
<!-- Get parameters -->
{{- $alt := .Get "alt" | default "" -}}
+{{- $caption := .Get "caption" | default "" -}}
{{- $rotation := .Get "rotation" | default 0 -}}
<!-- Get quality -->
@@ -30,5 +31,7 @@
<figure>
<img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" />
- <figcaption>{{ $alt }}</figcaption>
+ {{- if ne $caption "" -}}
+ <figcaption>{{ $caption }}</figcaption>
+ {{- end -}}
</figure>