congo/layouts/shortcodes/screenshot.html

27 lines
842 B
HTML
Raw Normal View History

2021-08-11 05:28:33 +00:00
{{ if .Get "src" }}
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
<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 }}