congo/layouts/shortcodes/screenshot.html

28 lines
869 B
HTML
Raw Permalink Normal View History

2021-08-11 05:28:33 +00:00
{{ if .Get "src" }}
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
2023-12-26 00:22:55 +00:00
<!-- prettier-ignore -->
2021-08-11 05:28:33 +00:00
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- if .Get "href" -}}
<a href="{{ .Get "href" }}">
{{- end -}}
2023-11-26 01:23:34 +00:00
{{ $altText := "" }}
{{ with .Get "alt" }}
{{ $altText = . }}
{{ else }}
{{ $altText = (.Get "caption") | markdownify | plainify }}
{{ end }}
2023-11-29 13:51:44 +00:00
{{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := $.Page.Site.Params.enableImageWebp | default true }}
{{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true "lazy" $lazy "webp" $webp) }}
2023-11-26 01:23:34 +00:00
{{- if .Get "href" }}</a>{{ end -}}
{{- if .Get "caption" -}}
<figcaption>
{{- .Get "caption" | markdownify -}}
</figcaption>
{{- end }}
2021-08-11 05:28:33 +00:00
</figure>
{{ end }}