blob: e2a5db9ab86e0f31879f0cc7ef9cd423d2ee7bc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!-- https://gohugo.io/content-management/image-processing/ -->
<!-- Get image -->
{{- $image := .Page.Resources.Get (.Get "src") -}}
<!-- Get parameters -->
{{- $alt := .Get "alt" | default "" -}}
{{- $caption := .Get "caption" | default "" -}}
{{- $rotate := .Get "rotate" | default 0 -}}
{{- $quality := .Get "quality" | default 90 -}}
{{- $size := .Get "size" | default 1200 -}}
<!-- Make image -->
{{- if ne $quality "original" -}}
{{- $image = $image.Resize (printf "%dx q%d r%d" $size $quality $rotate) -}}
{{- end -}}
<!-- TODO add multiple quality/fallback options + webp -->
<figure>
<img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" />
{{- if ne $caption "" -}}
<figcaption>{{ $caption }}</figcaption>
{{- end -}}
</figure>
|