diff --git a/assets/styles/root/050_figures.css b/assets/styles/root/050_figures.css index c27c36e..7b75591 100644 --- a/assets/styles/root/050_figures.css +++ b/assets/styles/root/050_figures.css @@ -10,7 +10,13 @@ margin-inline: 0; overflow: hidden; max-width: var(--content-width); - width: 100%; + } + + figure > .container { + align-items: center; + display: flex; + justify-content: center; + gap: var(--body-item-spacing); } figure.bordered { @@ -28,7 +34,6 @@ border-radius: 6px; height: auto; max-width: var(--content-width); - width: 100%; } figure svg { diff --git a/layouts/shortcodes/figures/image.html b/layouts/shortcodes/figures/image.html index 72e8eb2..bac593e 100644 --- a/layouts/shortcodes/figures/image.html +++ b/layouts/shortcodes/figures/image.html @@ -1,11 +1,36 @@ -{{- $img := (.Page.Resources.GetMatch (.Get "name")) -}} -{{- $resized_img := $img.Fit "1280x1280" -}} -{{- $altText := $img.Params.alt | default $img.Title -}} +{{- $imgs := slice -}} + +{{- if .Get "name" -}} + {{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}} +{{- else if .Get "names" -}} + {{- range (split (.Get "names") ",") -}} + {{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}} + {{- end -}} +{{- else -}} + {{ errorf "Missing name or names parameter to figures/image" }} +{{- end -}} + +{{- if lt (len $imgs) 0 -}} + {{ errorf "No images found for name(s) parameter" }} +{{- end -}} + +{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} +
- - {{ . }} - - {{ if $img.Title }} -
{{ $img.Title }}
- {{ end }} +
+ {{ range $img := $imgs -}} + {{- $resizedImg := $img.Fit "1280x1280" -}} + {{- $altText := $img.Params.alt | default $img.Title -}} + + {{ . }} + + {{- end }} +
+ {{ if and $shouldShowTitle -}} + {{- range $imgs -}} +
{{ .Title }}
+ {{- end -}} + {{- end }}