diff --git a/layouts/partials/page/figures/inline-image.html b/layouts/partials/page/figures/inline-image.html new file mode 100644 index 0000000..d54bd09 --- /dev/null +++ b/layouts/partials/page/figures/inline-image.html @@ -0,0 +1,24 @@ +{{- $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 -}} + +
+ {{ $image.Content | safeHTML }} + {{ if .shouldShowTitle }} + {{ partial "page/figures/caption.html" (merge . (dict "resource" $image)) }} + {{ end }} +