sandvich.xyz/layouts/shortcodes/imgproc.html

27 lines
1006 B
HTML

{{- with $.Get 0 }}
{{- with $i := $.Page.Resources.Get . }}
{{- with $spec := $.Get 1 }}
{{- with $i.Process . }}
<figure>
<a class="image" href="{{ .RelPermalink }}">
<img style="max-width: 100%;" src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
</a>
<figcaption>
<i>
{{- with $.Inner }}
{{ . }}
{{- end }}
</i>
</figcaption>
</figure>
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (1) containing the image processing specification. See %s" $.Name $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (0) indicating the image path, relative to the current page. See %s" $.Name $.Position }}
{{- end }}