24 lines
723 B
HTML
24 lines
723 B
HTML
{{- $image := .page.Resources.GetMatch .name -}}
|
|
|
|
{{ if not $image }}
|
|
{{ errorf "No images named '%s' found. %s " .name .page.Permalink }}
|
|
{{ end }}
|
|
|
|
{{ if ne $image.MediaType.SubType "svg" }}
|
|
{{ errorf "Only SVGs may be inlined. %s" $image.Permalink }}
|
|
{{ end }}
|
|
|
|
{{- $classes := slice "figure" "figure--image" "figure--inline-image" -}}
|
|
{{- if eq .size "main" -}}
|
|
{{ $classes = $classes | append "figure--main-column" }}
|
|
{{- end -}}
|
|
{{- with .class -}}
|
|
{{ $classes = $classes | append . }}
|
|
{{- end -}}
|
|
|
|
<figure class="{{ delimit $classes " " }}">
|
|
{{ $image.Content | safeHTML }}
|
|
{{ if .shouldShowTitle }}
|
|
{{ partial "page/figures/caption.html" (merge . (dict "resource" $image)) }}
|
|
{{ end }}
|
|
</figure>
|