summaryrefslogtreecommitdiff
path: root/themes/blowfish/layouts/shortcodes/screenshot.html
blob: 39640ac31b1d9bc1a0b744e6d24a321b633c4420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{ 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 -}}
    <img src="{{ $image.RelPermalink }}"
      {{- if or (.Get "alt") (.Get "caption") }}
        alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
      {{- end -}}
      width="100%"
      height="auto"
      style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"
    />
    {{- if .Get "href" }}</a>{{ end -}}
    {{- if .Get "caption" -}}
      <figcaption>
        {{- .Get "caption" | markdownify -}}
      </figcaption>
    {{- end }}
  </figure>
{{ end }}