summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img-center.html
blob: 573650772ccd0635e07518385533181813553c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{{- $file := .Get 0 }}
{{- $path := printf "content_images/%s" $file}}
{{- $img := resources.Get $path }}
{{- $caption := .Get 1 }}
{{- $source := .Get 2 }}
{{- $img = $img.Resize "500x webp" }}
<figure>
  <img class="centered" alt="{{ $caption }}" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
	<figcaption>
    {{ $caption }}

    {{- if $source }}
      <a href="{{ $source }}" target="_blank" title="source">[source]</a>
    {{ end }}
	</figcaption>
</figure>